Generating Functions - Number of numbers with sum of digits $\leq 7$

313 Views Asked by At

How many natural numbers with $n$ digits are there, where the sum of their digits is $\leq 7$?

So I said the following:

For the first digit (MSB) we can't have a zero, and all the other $n-1$ digits they can be anything from $[0,..9]$ so I said: $F(x) = (x + x^2 + ... + x^9) \cdot (1 + x^2 + ... + x^9)^{n-1}$ and we are searching for the coefficients of $x^7, x^6, ... x$ But how do we exactly start solving this generating function?