Is there a way to exactly parameterise all the solutions to the equation $x + y + z = 2n$, for $z$ less than or equal to $y$, less than or equal to $x$, for positive integers $x,y,z$?
For example, for $n=4$ it is not hard to find explicitly the solutions: $(6,1,1), (5,2,1), (4,3,1), (4,2,2), (3,3,2)$. It seems like a promising strategy is to increment down $x= 2n -2$ in steps of $1$, but as n gets large, this seems like a daunting branching task.
I am aware that the number of solutions is the closest integer to $n^{2}/3$, but I am looking for a sequence that explicitly generates all of these triplets. Moreover, I want this sequence to be 'minimal', i.e. to contain no repeats: is this problem solvable?
I have a way to enumerate these triplets by considering $(2n-2i+2,i+j-1,i-j+1)$ and letting j vary from 1 to i and i vary from 1 to n, however, these produce many repetitions (which makes sense, as we have $n(n+1)/2$ elements as opposed to the nearest integer to $n^{2}/3$).
It is not good enough for me to simply delete the repetitions- I need the number of elements in this generating sequence to be precisely equal to the number of distinct solutions- so the minimal set of solutions.
First notice that for $n=1$ you have that $x+y+z>2$ and thus that there are no solutions. So assume $n>1$.
Just fix $x$ to be the smallest positive integer $1$. Notice that $z=2n-x-y$ and thus you can let $y=1$ and see if it fits, then $y=2$, etc. until you cannot satisfy $z\geq y\geq x>0$ anymore. If you had all triples with $x=1$, then move to $x=2$ and do the same procedure again. And so on, until $x$ becomes too large to even find a value for $y$ and then the procedure stops.
Above gives an algorithm to find all triples satisfying $x+y+z=2n$.