I'm sorry I have asked until now up to three questions regarding the same topic, but tomorrow I have a Combinatorics exam and I'm practising in order to be ready and do my best. Here is the question: I am requiered to find how many numbers in the set $\{1\dots 1000\}$ there are whose sum of digits is $5$. Here is my attempt:
I started separating in cases, depending on how many digits there were:
- If we only have one digit, it is easy: only the number $5$ satisfies it: 1 option
- If we have two digits, it is the same as solving $x_1 + x_2 = 5$, where $x_i$ is the $i$-digit and $x_1 \geq 1, x_2 \geq 0$. The number of solutions is, if I'm not wrong, ${5 \choose 1} = 5$
- If we have three digits, the argument is the same as above, but with three variables: $x_1 + x_2 + x_3 = 5, x_1 \geq 1, x_2,x_3 \geq 0$. The number of solutions is ${6 \choose 2} = 15$. Therefore, and since cases are mutually exclusive, the result would be the sum of these three options: $21$. Am I right?