-3
$\begingroup$

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.

$\endgroup$
1
  • 4
    $\begingroup$ Please don't post the same question repeatedly. $\endgroup$
    – lulu
    Commented Jul 14, 2022 at 11:25

4 Answers 4

1
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ This indeed enumerates all solutions algorithimically and without repetition- however, I am looking for a sequence of length $n^2/3$ whose elements are triplets, which precisely determine the solution (for example for the case of pairs x + y = n this is done by the answer below) $\endgroup$
    – Noam
    Commented Jul 14, 2022 at 12:45
  • $\begingroup$ @Noam Both answers are the same: loop over x, then loop over y. You get a sequence by just putting the solutions in a sequence. $\endgroup$
    – Sera Gunn
    Commented Jul 14, 2022 at 12:57
  • $\begingroup$ But the method below does yield repetitions- for n=8 you have x=4=y' giving y=1, z=3 but also x=3, y'=5, giving y=1, z=4 (so that 1,3,4 appears twice) $\endgroup$
    – Noam
    Commented Jul 14, 2022 at 13:00
1
$\begingroup$

For any $x,n\in \mathbb N$, let $A(x,n)$ denote the list of valid triples summing to $2n$ whose first coordinate is $x$, sorted in increasing order of their second coordinate. We can give an explicit description for $A(x,n)$: $$ A(x,n):= [(x, y, 2n-x-y) \quad\text{ for }\quad \lceil n-x/2\rceil \le y \le \min(2n-x-1,x)] $$ For example, take $x=15$ and $n=13$. Since $\lceil 13-15/2\rceil=6$, $y$ will start at $6$, and since $\min(2\cdot 13-15-1,13)=\min(10,13)=10$, $y$ will end at $10$. The result is $$ A(15,13)=[(15,6,5),(15,7,4),(15,8,3),(15,9,2),(15,10,1)] $$ Then the following list enumerates all valid triples exactly once: $$ A(\lceil 2n/3\rceil,n)\oplus A(\lceil 2n/3\rceil + 1,n)\oplus \dots \oplus A(2n-2,n) $$ That is, we take all of the lists $A(x,n)$ for $x$ between $\lceil 2n/3\rceil$ and $2n-2$, inclusive, and concatenate them altogether.

To see that this works, note that all of the triples within $A(x,n)$ are distinct, since they all have different $y$-coordinates. Furthermore, for any $x\neq x'$, all of the triples in $A(x,n)$ are distinct from all of $A(x',n)$, since the $x$-coordinates differ.

$\endgroup$
0
$\begingroup$

The equation $x+y=n$ for $x,y\ge 1$ has the solutions $\{(x,n-x)|x=1,...,n-1\}$. Once you have this, to solve $x+y+z=n$ you solve the pair

$$x+y'=n$$ $$y+z=y'$$

Each solution to the top equation $x,y'$ determines a value for $y'$ in the second. Then using each value obtained for $y'$ gives a separate equation for $y,z$ to be solved. This idea is called recursion.

To get your equation, replace $n$ with $2n$.

Using this idea, the parametrisation becomes

$$(x,y,z)=(x,y,2n-x-y)$$

where you take all integers $x>0$ and $y>0$ satisfying $n-x/2\le y\le x$.

$\endgroup$
5
  • $\begingroup$ Thanks-this is a nice idea, but it seems to me it will yield repetitions, for example for n=8 will yield 1 + 3 + 4 in two different ways. I am trying to formulate a sequence of length $𝑛^2/3$ whose elements are triplets and which precisely determines all the solutions, in much the same way as the set you constructed for x + y = n. $\endgroup$
    – Noam
    Commented Jul 14, 2022 at 12:52
  • $\begingroup$ If you want to get only solutions in decreasing order $x>y>z$ then only take the solutions $\{(x,n-x)|n>x>n/2\}$ to each equation of the form $x+y=n$ $\endgroup$ Commented Jul 14, 2022 at 12:58
  • $\begingroup$ I want to allow for x greater or equal to y, greater or equal to z: I am trying out your parametric construction above right now to see if it indeed produces all such triplets, whilst not having any redundancies $\endgroup$
    – Noam
    Commented Jul 14, 2022 at 13:13
  • $\begingroup$ Indeed as I want to allow all distinct triplets that add up to 2n the construction above does not quite work, and I've tried relaxing the strict inequalities but this again produces repetitions $\endgroup$
    – Noam
    Commented Jul 14, 2022 at 13:52
  • 1
    $\begingroup$ You're right, my mistake. It is fixed now. $\endgroup$ Commented Jul 14, 2022 at 14:36
0
$\begingroup$

You can use generating functions

Let us change the question to an equivalent
$y +(y+a) +(y+a+b) = 3y+2a+b = 2n$ over the integers with $y\geq 1,a,b, \geq 0$

Generating functions of $3y,\; 2a,\; b\;$ are respectively $\frac{x^3}{1-x^3},\;\; \frac{1}{1-x^2},\;\; \frac{1}{1-x}$

Finally, find the coefficient of $x^{2n}\;$ in the expansion of $\frac{x^3}{1-x^3}\cdot\frac{1}{1-x^2}\cdot \frac{1}{1-x}$


ADDED

For example, for $2n=12$, the coefficient is seen as $12$, and confirmed, viz
$11\small{X},$$\;\;129,\;\;138,\;\;147,\;\;156,\;\;228,\;\;237,\;\;246,\;\;255,\;\;336,\;\;345,\;\;444$

$\endgroup$
1
  • $\begingroup$ @Noam: By mistake, (or by habit), I took weakly increasing triplets instead of weakly decreasing ones. Of course, it doesn't matter, really. $\endgroup$ Commented Jul 15, 2022 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .