How do you find all (non-trivial) $(x, y)$ such that $$x^2 + y^2 = 2017^2?$$

I really don't want to go through trial and error, like what I managed to do here:

So, we can rewrite the equation as $x^2 = 2017^2 - y^2 \implies x^2 = (2017 + y)(2017 - y).$ From there, I know nothing but guessing values of $y,$ which would be rather painful.

Yes, I know the Babylonian method of finding Pythagorean triples, but I figured since $2017$ is prime it would still simplify to $x^2 + y^2 = 2017^2.$

Ah, I got my Babylonian method wrong. It is for $a, b, c, m, n \in \mathbb{Z}$ such that $a^2 + b^2 = c^2$ and (WLOG) $m > n,$

\begin{align} a &= k\left(m^2 - n^2\right) \\ b &= 2kmn \\ c &= k\left(m^2 + n^2\right) \end{align}

marked as duplicate by Community♦Mar 30 '17 at 20:58

• No, if the Babylonian method is what I think it's referring to, that would be $a = m^2 - n^2$, $b = 2mn$, $c = m^2 + n^2$. So, since $2017 = 44^2 + 9^2$, that would give the Pythagorean triple $(44^2 - 9^2, 2 \cdot 44 \cdot 9, 44^2 + 9^2) = (1855,792, 2017)$. – Daniel Schepler Mar 30 '17 at 20:47
• @DanielSchepler Thank you sir. I though it was $c^2 = m^2 + n^2.$ No wonder… Now that I actually can use Babylonian method this problem is much easier. – Reality Check Mar 30 '17 at 20:48