How many solutions of equation

How many solutions of equation $x_1+x_2+x_3+x_4=n$ in $N_0$ such that $x_1\leq x_2\leq x_3 \leq x_4$?

I found solutions of $x_1+x_2+x_3=n$ in $N_0$ , $x_1\leq x_2\leq x_3$ in the following way :

Let $S$ set of all solutions and $A_k$ set of all solutions of equation $x_1+x_2+x_3+x_4=n$, for which is $k=x_1\leq x_2\leq x_3$, $k\in 1,2,..., [\dfrac {n}{3} ]$. Sets $A_0,...,A_{[\dfrac{n}{3}]}$ are disjoint.
$a=x_2-k$, $b=x_3-k$. $|A_k|$ is number of pairs $(a,b)$ such that $a+b=n-3k$ and $a\leq a \leq b$
$|A_k|=[\dfrac{n-3k}{2}]+1$ and $|S|=\sum _{k=0}^{[\dfrac{n}{3}]}|A_k|$. It is complicated for equation $x_1+x_2+x_3+x_4=n$ . I need another way to solved it.

• I assume that you want the $x_i$'s to be positive from the statement about $k$. – Michael Burr Apr 15 '15 at 13:20
• Positive or zero. – JJMM Apr 15 '15 at 13:38
• Let $y_1=x_1,y_2=x_2-x_1,y_3=x_3-x_2,y_4=x_4-x_3$ and solve for $y_i\geq 0$ the equation $4y_1+3y_2+2y_3+y_4=n$ – Lozenges Apr 15 '15 at 13:48

Sometimes a little research can help. The formula you posted was discovered by Jon Perry in 2003.

The generating function for this problem is:

$$g(x) = \frac{1}{(1-x) \left(1-x^2\right) \left(1-x^3\right) \left(1-x^4\right)}$$

There does not seem to be something simple for your question but Michael Somos comes up with

$$a(n)=\text{Round}\left[\frac{1}{288} \left(2 (n+5)^3-3 (n+5) \left(5+3 (-1)^{n+5}\right)\right)\right]$$

For a whole lot more:

A001400