How many natural numbers smaller than $10\,000$ that have no digit $0$ and the sum of their digits equals $9$?
I am really having a hard time solving this question. Any help would be appreciated!
How many natural numbers smaller than $10\,000$ that have no digit $0$ and the sum of their digits equals $9$?
I am really having a hard time solving this question. Any help would be appreciated!
Hint $1$: You can divide the problem into the cases of $1$ digit, then of $2$ digits, then $3$ and finally $4$ (why not more?)
Hint $2$: Use stars and bars.
One approach is to preload each digit position with one unit, then split the remaining $5$ units across the four positions using stars and bars, giving $\binom 83$ options for the four-digit numbers. Similarly you can calculate the options for $3,2$ and $1$ digit numbers.
Note that a natural number less than $10000$ with no $0$ is always a four digit number. (We only require that the first digit is not $0$, which is certainly true.) Then the question becomes: how many $4$ tuples of positive integers have a sum of $9$? This is also known as a stars and bars problem. From there, you can just read the link and see how to solve this.