# sum of primes squared equals a prime squared

Find all $$p_1,\dots,p_8$$ so that $$p_1^2+\dots+p_7^2 = p_8^2$$ What I have done so far:
Since an odd number $$n$$ has $$n^2 \equiv 1$$ (mod $$4$$) then the only two possibilities are if $$2$$ or $$6$$ of the primes on the left are $$2$$. When $$6$$ of them are $$2$$, then I found a solution when $$p_7 = 5$$ and $$p_8=7$$. I cannot figure out the other case though. I got to $$p_3^2 + p_4^2 + p_5^2 + p_6^2 + p_7^2 = p_8^2-8$$ but that's it. But I cannot find a way to find them all or prove none exist.

• Your equation for the second case is not correct. If 2 of them are 2, the right hand side is $p_8^2 - 8$. So your last example is also not correct. – user113102 May 28 at 21:08
• You're right. My bad – Kristin Petersel May 28 at 21:15
• Try working mod 8 in the second case. – user113102 May 28 at 21:36

As user113102 hints, if $$n$$ is odd, then $$n^2 \equiv 1 \bmod 8$$. Thus, in the equation $$p_3^2 + p_4^2 + p_5^2 + p_6^2 + p_7^2 = p_8^2 - 8$$ where all $$p_i$$ are odd primes, the LHS is congruent to $$5$$ mod $$8$$ and the RHS is congruent to $$1$$, so there is no solution.
It's easy to see, therefore, that the solution $$p_1 = \cdots = p_6 = 2, p_7 = 5, p_8 = 7$$ is therefore the only solution to the general case, as larger values of $$p_7$$ and $$p_8$$ would give $$p_8^2 - p_7^2 > 24$$.