How to determine the number of integer pairs $n_1,n_2$ such that $n_1+2n_2=n$, with $n,n_1,n_2=0,1,2,3,...$?

31 Views Asked by At

In the context of a Quantum Physics problem with degenerate energy levels, I need to find the number of different pairs of integers $(n_1,n_2)$ such that $n_1+2n_2$ gives the same value $n$, with $n,n_1,n_2=0,1,2,3,...$.

While this is easily feasible by studying the graph $n_1(n_2)=n-2n_2$, or with computer code, is there any straightforward way to determine it algebraically?