5

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.

Neo
  • 247

2 Answers2

8

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.

Brian M. Scott
  • 616,228
  • Sir, in my books which I use, such techniques are not mentioned. Can you please suggest a good book for learning combinatorics and counting ? I have already read a post which asks for resources to learn combinatorics , but I would like to hear one from you. – An_Elephant Jan 23 '23 at 15:30
  • @An_Elephant: I’m fond of Miklós Bóna, Introduction to Enumerative Combinatorics; it’s extremely well written and doesn’t require a lot of background. I don’t have Arthur T. Benjamin & Jennifer Quinn, Proofs that Really Count: The Art of Combinatorial Proof, but I’ve heard very good things about it, and the extracts that I’ve seen are very good. – Brian M. Scott Jan 23 '23 at 21:45
  • Thanks very much sir. I'll definitely give a read on the first because I am a beginner. Good day ! – An_Elephant Jan 24 '23 at 08:10
  • 1
    @An_Elephant: You’re very welcome. – Brian M. Scott Jan 24 '23 at 08:46
2

Let $x_{1}, x_{2}, x_{3}, x_{4}, x_{5} \geq 0$ be the 5 digits of the number. Then the number of numbers from 1 to 99999 that have a digit sum of 8 are the integer solutions to the equation $x_{1} + x_{2} + x_{3} + x_{4} + x_{5} = 8$. This problem is combinatorially identical to the number of distributions of $8$ indistinguishable objects to $5$ distinguishable people, hence, ${8 + 4 \choose 4}$. For more on why that is, see my answer here:

Combinatorics Distribution - Number of integer solutions Concept Explanation

Alex Wertheim
  • 20,278