1. ## combinatorics (numbers whose digits add up)

Ive been stuck on this problem for a while.
We're supposed to find the number of numbers whose digits add up to 20 between 0 and 999,999.
I've done it with adding up to 15, which is just 20C5 - 6 * 10C5 but now I am stuck.
I know that the total numbers that add up to 15 including violators is 25C5 but I can't figure out how to handle the incorrect cases.
I thought about just checking for one of the numbers > 10 and then just subtract the case if two numbers were 10 exactly, but that didnt' work.
My incorrect equation for that is 25C5 - 6 * 15C5 - 6C2.

Any thoughts?

Thanks

2. ## Re: combinatorics (numbers whose digits add up)

Ive been stuck on this problem for a while.
We're supposed to find the number of numbers whose digits add up to 20 between 0 and 999,999.
I've done it with adding up to 15, which is just 20C5 - 6 * 10C5 but now I am stuck.
I know that the total numbers that add up to 15 including violators is 25C5 but I can't figure out how to handle the incorrect cases.
I thought about just checking for one of the numbers > 10 and then just subtract the case if two numbers were 10 exactly, but that didnt' work.
My incorrect equation for that is 25C5 - 6 * 15C5 - 6C2.
I worked this problem using a generating function.
As you can see $35127x^{20}$ appears, giving the answer.

Notice that your work $\binom{25}{5}-6\cdot\binom{15}{5}{\color{red}+}\binom{6}{2}=3512 7$ gives the same answer.
NOTE the ${\color{red}+}$.