[Math] In how many ways I can write a number $n$ as sum of $4$ numbers

discrete mathematicsnumber theory

The precise problem is in how many ways I can write a number $n$ as sum of $4$ numbers say $a,b,c,d$ where $a \leq b \leq c \leq d$.

I know about Jacobi's $4$ square problem which is number of ways to write a number in form of sum of $4$ squares number. There is a direct formula for it. Is there a direct formula for this problem too?

Edit: All the numbers are positive integers greater than $0$.
Example: For $5$ there is only one way $1,1,1,2$.

Best Answer

Note that this problem is equivalent to the problem of partitioning $n$ into $4$ parts.

In number theory, a partition is one in which the order of the parts is unimportant. Under these conditions, we are under the illusion that the order is important, however we can only order any given combination of $4$ parts in $1$ way. Thus, the order is unimportant.

There is a well known recurrence for $p(n,k)$, the number of partitions of $n$ into $k$ parts. It is given by $$p(n,k) = k\cdotp(n-1,k) + p(n-1,k-1).$$ Your question is only concerned with the case of $k=4$.

Related Question