2
$\begingroup$

How many 100-digit numbers' sums of digits equal 3? How do I solve this?

  • 1
    It can have three ones and $97$ zeros, for example. Or one $1$, one $2$ and $98$ zeros, or one three and $99$ zeros.2017-01-22

2 Answers 2

4

We have a few possibilities.

A 1 with two other ones somewhere. $99\choose{2}$
A 1 with a two somewhere else $99\choose{1}$
A 2 with a one somewhere else $99\choose{1}$
A 3 with 99 zeroes $1\choose{1}$

$${99\choose2} + {99\choose1} + {99\choose1} + {1\choose1} = 4851 + 99 + 99 + 1 = 5050$$

  • 3
    There are $\binom {99} 2$ numbers that has three ones and $97$ zeros, assuming that the first digit can not be zero..2017-01-22
  • 0
    @ajotatxe, if we think of each number as a piece of a chain, we get $100!$ because there are 100 numbers, (3 ones and 97 0's), and each can be used once.2017-01-22
  • 0
    The number of ways to put $3$ identical objects in $100$ distinguishable slots is $\binom {100}3$. Here you need to start with $1$, as otherwise the number doesn't really have $100$ digits, so you are really putting $2$ identical objects in $99$ slots, hence $\binom {99}2$.2017-01-22
  • 0
    @lulu, you're right, editing2017-01-22
  • 1
    To be clear: the other counts are also wrong. For example, there is only one case which uses $3$, namely put the $3$ in the leading slot and $0's$ in all the others.2017-01-22
  • 0
    This looks good (+1).2017-01-22
1

You may also want to check out integer partition or integer composition which counts the number of ways to sum to a number. 3 is such a small number so we don't have to think much about it for this particular problem, but it becomes increasingly useful when considering larger sums.

In this language what Travis does is to enumerate the compositions of the number 3:

3

2+1

1+2

1+1+1

As you can see in his answer each of them get their own combinatorics term in the sum.