A former Olympiad exercise is to find all pairs of integers $(x,y)$ such that $$x(x+1)(x^2+x+2)=2y^2.$$

I could not solve this equation. How can one find all solutions?

I tried to rewrite the above equation in a different form, but it did not help. For example, the equation is equivalent to \begin{align*} x(x+1)(x(x+1)+2)=2y^2&\iff (x(x+1))^2 + 2x(x+1) +1 =2y^2 +1\\ &\iff (x(x+1)+1)^2 =2y^2 +1\end{align*}

Can you tell me how to attack this problem?

Best wishes

  • $\begingroup$ I think the best way to start when you have no idea whatsoever is to find some solutions by brute force. They might help you figure out a pattern. $\endgroup$ Jan 18, 2018 at 5:51
  • $\begingroup$ Do you expect that there are solutions for really large numbers? why/why not? $\endgroup$
    – user24142
    Jan 18, 2018 at 5:52
  • $\begingroup$ Are you allowed to graph for such problems? If so: desmos.com/calculator/vhc57baql1 You can see some answers in the parts close to the origin where some parts of the graph have gradient $1$ or $-1$. $\endgroup$ Jan 18, 2018 at 5:56
  • $\begingroup$ @Mohammad: Some solutions are easy to see, namely (0,0) and (-1,0). All other solutions must have $y\neq 0$. $\endgroup$ Jan 18, 2018 at 6:03
  • 1
    $\begingroup$ I have discovered $6$ solutions: $(0,0); (-1,0); (-2, 2); (-2, -2); (1, 2)$ and $(1, -2)$ and I think these are all. $\endgroup$ Jan 18, 2018 at 6:04

2 Answers 2


Set $z=x^2+x$, then we want $z(z+2) = 2y^2$. So $z$ is even and with $w=z/2 \in\Bbb{Z}$, we get the new Diophantine equation $$2w(w+1) =y^2.$$

Notice that since $x^2+x=z$ has no real solution for $z<\frac{1}{4}$, we can assume $w\ge0$.

  • If $2|w$, then since $gcd(2w, w+1)=1$ we have that $w+1$ is a square. Then $2w=z$ is a square, and so is $4z$. But since $x = -\frac{1}{2} \pm\sqrt{z+\frac{1}{4}}$ is an integer, $4z+1$ is a square. So $z=w=0$ which means $y=0$, and the two solutions for $x$ are $0$ and $-1$.

  • If $2$ does not divide $w$, then $gcd(w, 2(w+1))=1$ implies that $w$ is a square, and this implies that $w+1 = 2k^2$ for $k\in \Bbb{Z}$. So $$x^2 +x = 2w = 4k^2-2$$ and since $x = -\frac{1}{2} \pm\sqrt{4k^2-2+\frac{1}{4}} \in \Bbb{Z}$, we have that $16k^2-7$ is a square. So is $16k^2$, and the only integer squares with difference $7$ are $16$ and $9$, so $k=1$, so $w=1$, so $y= \pm2$ and the possibilities for $x$ are $1$ and $-2$.

  • $\begingroup$ Your equation $2w(w+1)=y^2$ has infinitely many solutions, for example, $w=49$, $y=70$. The hard part is determining which of these solutions then give solutions for $x^2+x=2w$. $\endgroup$
    – David
    Jan 18, 2018 at 6:31
  • $\begingroup$ @David: Right, I was too fast there. I will correct. $\endgroup$ Jan 18, 2018 at 6:32
  • $\begingroup$ Good luck!$\,\!$ $\endgroup$
    – David
    Jan 18, 2018 at 6:32
  • $\begingroup$ @David: I think I got it now. $\endgroup$ Jan 18, 2018 at 9:43

Since $gcd(x^2+x,x^2+x+2)=2$ we have $x^2+x=2a^2$ and $x^2 +x+2=b^2$ or $x^2+x = a^2$ and $x^2+x+2=2b^2$ where $a,b$ are relatively prime.

1st case: for $x>-2$ we have $$ x^2 <x^2+x+2<(x+1)^2$$ which is impossible. If $x<-1$ then we have $$(x+1)^2 <x^2+x+2<x^2$$ which is again impossible.

2nd case: for $x>0$ we have $$x^2<x^2+x<(x+1)^2$$ which is impossible. So we are left with the case if $x<-1$ we have $$(x+1)^2<x^2+x<x^2$$ impossible. So $x=0$ or $x=-1$...

  • $\begingroup$ How do you prove that they're all the solutions? $\endgroup$ Jan 18, 2018 at 6:22
  • $\begingroup$ I think your first chain of inequalities holds for $x>1$ (since you need $x+2<2x+1$), hence excludes this case; whereas the second (still in "1st case") holds for $x<-2$ (since you need $x+2<0$), hence excludes that case. Remains indeed the case $x\in\{-2,-1,0,1\}$ which each occur, with the corresponding $y$'s: $\pm2, 0, 0, \pm2$ are immediately calculated $\endgroup$ Jan 19, 2018 at 5:34

This site is temporarily in read-only mode and not accepting new answers.

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