How many positive integers have less than $90000$ have the sum of their digits equal to $17$? How many positive integers have less than $90000$ have the sum of their digits equal to $17$?
I tried to write the number as $ABCDE$ and use some math with that (so we need $A + B + C + D + E = 17$), and I tried to use stars and bars, but I got no progress.
Can someone please help me?

You need to find the number of solutions of $$A+B+C+D+E=17$$
where $0\leq A\leq 8$ and all other variables lie between $0$ and $9$. Check that it is coefficient of $x^{17}$ in the following expression:
$$(1+x+x^2+x^3+x^4+x^5+x^6+x^7+x^8)$$
$$\times(1+x+x^2+x^3+x^4+x^5+x^6+x^7+x^8+x^9)^4$$
Now, apply GP formula and simplify, i.e.
$$Expression = \frac{1-x^9}{1-x}\times\Big(\frac{1-x^{10}}{1-x}\Big)^4$$
$$ = \frac{(1-x^9)(1-x^{10})^4}{(1-x)^5}$$
Now, apply binomial expansion in $(1-x^{10})^4$ and ignore terms which don't contribute to term of $x^{17}$, we get,
$$\frac{(1-x^9)(1-4x^{10})}{(1-x)^5}$$
Now, you have terms with powers of $x$ as $0,9\&10$ in numerator, find the coefficients of $x^{17}, x^8\& x^7$ in the power series expansion of denominator using formula and you are done.
Hope it helps:)
