Distinct ways three integers can sum to a constant

121 Views Asked by At

So I am doing some quantum mechanics and it has led to some combinatorics. I need to know how many distinct ways I can have $N_1+N_2+N_3=N$ where $N$ is fixed so we can change $N_1$, $N_2$ and $N_3$. So far I have tried an argument ordering the three where we choose $N_1$ then choose $N_2 \in {0,1,...,N-N_1}$ but then $N_3$ is fixed with no real way of knowing how many extraneous solutions we get by accidentally having $N_3>N_2$. An example would be if $N=2$ we have 2 possible solutions i.e. $(2,0,0)$ and $(1,1,0)$.

1

There are 1 best solutions below

1
On

In the language of additive number theory, you want to know how many partitions there are of an integer $n$ into at most three parts.

This is A001399 in the Online Encyclopedia of Integer Sequences, which gives the formula $A(N) = (N+3)^2/12$, rounded to the nearest integer.