2

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$.

N. F. Taussig
  • 79,074
  • I guess you mean all the "numbers" to be natural numbers, dont' you? –  Jun 28 '15 at 08:55
  • 1
    If you ignore the ascending order property and distinguish between say $4,4,3,4$ and $3,4,4,4$, you could say that if $N(n,k)$ is the number of ways writing $n$ as the sum of $k$ positive integers you'd have the recursive formula $N(n,k)= \sum_{j=1}^{n-k+1} N(n-j,k-1)$. – Zardo Jun 28 '15 at 08:58
  • What if I want to consider 4,4,3,4 and 3,4,4,4 same – Nitin Jaiman Jun 28 '15 at 09:04
  • Then your conditions of $a,b,c,d$ are not fulfilled –  Jun 28 '15 at 09:09
  • The formula for counting the number of partitions of an integer (37-6) into (4) parts can be of interest: https://math.stackexchange.com/questions/1341902/in-how-many-ways-i-can-write-a-number-n-as-sum-of-4-numbers. Not sure about how the number is affected if zero is allowed. – NoChance Apr 17 '24 at 22:10

2 Answers2

1

You can write a generating function for this problem. Let me generalize your question. For $n\in\mathbb{N}_0$ and $k\in\mathbb{N}$, let $a_k^n$ be the number of ways to write $n$ as a sum $x_1+x_2+\ldots+x_k$ of integers $x_1,x_2,\ldots,x_k$ such that $0\leq x_1\leq x_2 \leq \ldots \leq x_k$.

Observe that this is the same problem as writing $n$ in the form $y_1+2y_2+\ldots+ky_k$, where $y_1,y_2,\ldots,y_k\in\mathbb{N}_0$. To see this, we take $y_k:=x_1$ and $y_{k-i}:=x_{i+1}-x_i$ for $i=1,2,\ldots,k-1$. Hence, the generating function $f_k(t):=\sum_{n=0}^\infty\,a_n^k\,t^k$ is given by $$f_k(t)=\prod_{i=1}^k\left(\sum_{r=0}^\infty\,t^{ir}\right)=\prod_{i=1}^k\,\left(\frac{1}{1-t^i}\right)=\frac{1}{\prod_{i=1}^k\,\left(1-t^i\right)}\,.$$

For example, $f_4(t)=1+t+2t^2+3t^3+5t^4+6t^5+9t^6+11t^7+\ldots$. One not-so-nice recursive formula for $a^n_k$'s is $a^n_k=1+\sum_{j=1}^{k-1}\,\sum_{r=1}^{\left\lfloor n/(j+1)\right\rfloor}a_j^{n-r(j+1)}=a_k^{n-k}+a_{k-1}^{n}$ for $n\in\mathbb{N}_0$ and for integers $k>1$, where $a^n_1=1$ for every $n\in\mathbb{N}_0$ and $a^0_k=1$ for every $k\in\mathbb{N}$. However, I think having the generating function is a sufficient answer. If you want the number of solutions in which $x_1 \geq 1$, then it is easily seen that the answer for each $n$ is $a^{n-k}_k$ if $n \geq k$, and $0$ if $n<k$.

Batominovski
  • 50,341
1

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$.