2

$$ x_1 + x_2 + x_3 = 19 $$ $$ 0\leq x_i\leq9, x_1\geq1$$

In case of three digits the constraint on first digit being greater than one doesn't matter as there is no combinations of digit with a zero. So in this case it will be ${21\choose19}-{3}{11\choose9}=45$

In the following step we have

$$x_1 + x_2 + x_3 + x_4 = 19$$

Similarly ${22\choose19}-{4}{12\choose9}=660$ but this time we are counting also all the strings with 0 in front so one option is to simply remove them by subtracting all the length 3 combinations that sum up to 19. And so we can proceed to the final answer.

My question is - can this be done in some other way? If yes, then how?

  • I have seen similar problems in the past, and it's my opinion that the way you are doing it is the best way. But I'll leave the floor open for someone else to pitch another strategy. – A. Thomas Yerger Aug 16 '16 at 20:49
  • What about using a recursive formula? As you said, you can subtract the previous one each time. – shardulc Aug 16 '16 at 20:52
  • It is the coefficient of the $x^{19}$ term of $(1+x^2 + x^3 +\cdots x^9)^6 = (\frac {x^{10} - 1}{x-1})^6$ – Doug M Aug 16 '16 at 21:37

1 Answers1

5

By stars-and-bars, the number of ordered $6$-tuples of nonnegative integers whose sum is $19$ is ${19+5 \choose 5} = 42504$. However, many of those will have one of the numbers $\ge 10$, which you don't want (note you can't have two such numbers or the sum would be at least $20$). The number of such $6$-tuples where the $i$'th number is $k$ is ${19+4-k \choose 4}$. You want to exclude all these where $i$ goes from $1$ to $6$ and $k$ from $10$ to $19$. So the answer is

$$ {19+5 \choose 5} - 6 \sum_{k=10}^{19} {19+4-k \choose 4} = 30492 $$

Robert Israel
  • 448,999