-3
$\begingroup$

I need to find all primes $p,q$ for which $p^2+q^2+2017$ is square.

I do not know how to solve this problem. Is there are general approach to detecting a square?

  • 7
    Hint: Look at it modulo four.2017-01-11

1 Answers 1

14

A square is always 0 or 1 (modulo 4). 2017 is also 1 (modulo 4), so in order for the sum $p^2 + q^2 + 2017$ to be 0 or 1 (modulo 4), $p^2$ and $q^2$ must be 0 modulo 4. Therefore, $p$ and $q$ must be even, and because they are primes, both are equal to 2. You can check that $4 + 4 + 2017 = 2025 = 45^2$ satisfies the equation, so the only solution to this problem is $p = q = 2$.