Consider the equation $x_1+x_2+...+x_r=n$ where all values are positive integers. How many solutions are there to this equation if $n$ is given? The order of the $x_i$s does not matter i.e. $1+2+3=6$ is the same as $1+3+2=6$.
The solution to the problem if order matters is $n-1 \choose r-1$ as is explained in the following post https://math.stackexchange.com/q/868790
I have tried solving for some specific cases of $r$:
- It's easy to see that for $r=2$ the number of solutions is $\Bigl\lfloor \frac{n-1}{2} \Bigr\rfloor$
- For $r=3$ one can count by doing $1+x_2+x_3$ then $2+x_2+x_3$ etc and using the above answer for $r=2$ to get $$\sum_{k=1}^{\lfloor \sqrt{n} \rfloor} \left[ \Bigl\lfloor \frac{n-k}{2} \Bigr\rfloor - (k-1) \right]$$
But if we try this same method for subsequent values of $r$ it quickly gets too complicated. Any help?