Number of possible combinations of x numbers that sum to y

This problem is equivalent to finding the number of integer solutions to $a+b+c+d+e=10$.

If you imagine your $10$ as a line of $10$ stars then you can insert $4$ "+" signs in between the stars to get a solution, for example $+\star\star+\star\star\star\star+\star+\star\star\star$ represent the solution $0+2+4+1+3$.

Since every permutation of stars and "+" signs represents a solution the total number of solutions is given by the possible permutations of this $14$ symbols, that is $\frac{14!}{10!4!}$. The same method, which is usually called stars and bars can be used for similar problems with other numbers involved.

Edit: in the case of $3$ numbers adding up to $10$ stars and bars gives $\frac{12!}{10!2!}=66$ as answer, you have $63$ because you didn't count the $3$ triplets with $2$ zeros and a ten, was that intended?


The answer from Alessandro Codenotti about 66 and three extra $(0,0,10), (0,10,0), (10,0,0)$ is correct. In general, let $n$ is a positive integer to partition, $k$ is the number of non-negative parts (zeros are included), the order of parts matters. Then, the total number of decompositions is the binomial coefficient $C(n+k-1,k-1)=\frac{(n+k-1)!}{(k-1)!n!}$.

This result is well known. For $n=10$, $k=3$, $C(10+3-1,3-1)=\frac{12!}{2!10!}=\frac{11\cdot 12}{2}=66$. For $n=10$, $k=5$, $C(10+5-1,5-1)=\frac{14!}{4!10!}=\frac{11 \cdot 12 \cdot 13 \cdot 14}{2 \cdot 3 \cdot 4}=77 \cdot 13=1001$. In both cases, one decides, if $k$ must be subtracted from the result to remove $k$ decompositions, where $n$ itself is in one of $k$ positions and accompanied by $k - 1$ zeros.