[Math] Find all possible three digit numbers whose digits’ sum equals 12

diophantine equations

How many 3 digit numbers exist such that the sum of their digits equals 12?
I ran a little program and found that there are $66$ of such numbers.

I feel that this type of problem is similar in style to that of the Diophantine equation $ax+by=c$ except in this case $a+b+c=12$ where $a,b,c,$ are positive integers.
The only problem is that I don't know how properly solve a Diophantine equation or for that matter even solve one without brute force and tears.

I thought about making a table and finding a pattern between the number of possible orders by increasing the hundreds digit by 1 and then counting.

Best Answer

We can solve this with the stars and bars method.

We need to find all non-negative solutions $a+b+c=11$ with $a\leq 8$ and $b,c\leq 9$. (the number is going to be $\overline{(a+1)bc}$).

To do this we first find all the solutions disregarding the upper bound on a,b,c.

This is simple with stars and bars. There are $11$ stars and $2$ bars, so $\binom{13}{2}=78$.

We now need to subtract the solutions in which $a\geq 9,b\geq 10$ and $c\geq 10$.(but none of them happen at the same time, so it is easy)

There are $6$ when $a\geq9$, $3$ when $b\geq 10$ and $3$ when $c\geq 10$.

Therefore the final answer is $78-6-3-3=66$

Related Question