Combinatorics – How Many Numbers from $1$ to $99999$ Have a Digit-Sum of $8$?

combinatoricsnumber theory

How many numbers from $1$ to $99999$ have a digit-sum of $8$?

Why is the answer ${8+4\choose 4}$?

Does the following method work?


Answer is the number of ways to split 8 into 5 digits,

i.e. number of ways to insert 4 lines among a row of 8 objects.

Best Answer

Yes, the reasoning below the line in your question is correct, though it can be expanded for greater clarity. Lay out a row of $8$ stars, say:

$$********$$

Now insert $4$ dividers to break them up into $5$ groups, e.g.,

$$*||***||****$$

From left to right read off the number of stars in each of the $5$ groups: $$10304$$

The result is clearly a number between $1$ and $99999$ whose digits sum to $8$. And the procedure is clearly reversible, so the number of ways of inserting the $4$ dividers really is the number of integers in which we’re interested. For example, starting with $352=00352$, we get

$$||***|****|**$$

The string of stars and dividers is a string of $8+4=12$ objects, and the $4$ dividers can go anywhere in this string, so there are $\binom{12}4$ ways to place them and therefore $\binom{12}4$ numbers of the desired kind.

Related Question