# Find integer triples $(x,y,z)$ such that $2018^x=y^2+z^2+1$

To find the triples, I had some tries. First , consider $x\ge 2$, then $2018^x=0\pmod 4$. But for the right side $y^2+z^2+1$. Consider 3 situations.

• case 1. Both $y$ and $z$ are even. Then $y^2+z^2+1=1\pmod 4$.
• case 2. One of them are even, the other is odd. Then $y^2+z^2+1=2\pmod 4$.
• case 3. Both $y$ and $z$ are odd. Then $y^2+z^2+1=3\pmod 4$.

Thus for $x\ge 2$, there is no solution. Then $x=0$ or $x=1$.
Now for $x=0$, $2018^0=y^2+z^2+1$ ,then $y^2+z^2=0$, hence we have $y=0$ and $z=0$.
For $x=1$, $2018^1=y^2+z^2+1$, then my question is how to solve $y^2+z^2=2017$.
Also since I didn't learn Number Theory systematically, I don't know if I was proceeding in the right way for this question.
Lastly, Are there more general methods for problems like this?

• Typesetting tip: instead of (\mod 4), which ends up with strange spacing, use \pmod 4, which has correct spacing and adds parentheses automatically (the p in pmod is for parentheses). Compare: $$5\equiv1(\mod 4)\quad\text{vs.}\quad5\equiv1\pmod 4$$ – Théophile May 14 '18 at 19:06

You have solved almost all cases. So let me add the solution for $x=1$, and exclude negative $x$. Since $2017$ is a prime which is congruent $1$ modulo $4$, it is representable as the sum of two squares. The solutions are, up to sign and order, given by $$2017=44^2+9^2,$$
$2017$ as the sum of two squares
You've done most of the work already; you might also want to explicitly exclude negative $x$. One way to find all solutions with $x=1$ without any advanced machinery is as follows:
From any solution of $2017=y^2+z^2$ we get another solution by changing the signs of $y$ and $z$ and by interchanging $y$ and $z$. So let's restrict our attention to nonnegative $y$ and $z$, where $y=2a$ is even and $z=2b+1$ is odd. Then $$2017=y^2+z^2=(2a)^2+(2b+1)^2=4a^2+4b^2+4b+1,$$ which tells us that $$a^2+b^2+b=504,$$ where $a$ and $b$ are nonnegative. Note that $b^2+b$ must be even, so also $a$ is even. This shows that $$a\leq\sqrt{504}<23\qquad\text{ and }\qquad b<\sqrt{b^2+b}\leq\sqrt{504}<23.$$ This leaves only $12$ values for $a$ to check. We can also continue by noting that $a^2\equiv0\pmod4$ and so $b^2+b\equiv0\pmod{4}$, which implies that $b$ is congruent to either $0$ or $3$ mod $4$, leaving only $11$ values for $b$ to check.