If $p$ is prime and $p>3$ and $k,l,m,n,p\in\mathbb N$ and $p^k+p^l+p^m=n^2$, prove that $8\mid p+1$. If $k,l,m,n,p\in\mathbb N$ and a prime number $p>3$ that satisfies $$p^k+p^l+p^m=n^2$$ is chosen, prove that $8\mid p+1$.
$n^2$, when divided by $8$, gives a remainder $1$ (it can't give the remainders $0$ and $4$, because three odd numbers sum up to an odd number, which, if it is a square, always gives a remainder 1 when divided by 8).
The prime numbers $p$ give these ones: 
When $p\equiv 1\pmod 8$, then $p^{2z}\equiv 1\pmod 8$ and $p^{2z+1}\equiv 1\pmod 8$.
When $p\equiv 3\pmod 8$, then $p^{2z}\equiv 1\pmod 8$ and $p^{2z+1}\equiv 3\pmod 8$.
When $p\equiv 5\pmod 8$, then $p^{2z}\equiv 1\pmod 8$ and $p^{2z+1}\equiv 5\pmod 8$.
When $p\equiv 7\pmod 8$, then $p^{2z}\equiv 1\pmod 8$ and $p^{2z+1}\equiv 7\pmod 8$.
Where $z\in\mathbb N\cup \{0\}$. We have to prove that $p\equiv 7\pmod 8$.
And another observation is that we could mark $p$ as either $3c+1$ or $3c+2$, where $c\in\mathbb N\cup\{0\}$ (we have to use the fact that $p>3$ somehow anyway). Thanks.
And I've given a tag "diophantine-equations" to this question because this seems a bit related to them. Feel free to disagree.

When $p\equiv 1\mod 8$, we now that $P=p^k+p^l+p^m\equiv 1+1+1\equiv 3\not \equiv 1\mod 8$. When $p\equiv 5\mod 8$, we get $P\equiv 1+1+1\equiv 3\not\equiv 1\mod4$, so this won't work either. When $p\equiv 3\mod 8$, we get $3+3+3\equiv 1\mod 8$ (and the other possibilities won't work), so the only case we still have to shoot is $k\equiv l\equiv m\equiv 1\mod 2$ with $p\equiv 3\mod 8$.
Now, we know $p|n$, so $p^2|n^2$, so $p^2|P$, so $k,l,m\geq 2$ (because $p>3$). Thus $k,l,m\geq 3$, because they are odd. Now, we get $p^3|n^2$, so $p^2|n$, so $p^4|n^2$. Thus, $k,l,m\geq 5$. This will continue forever, so there aren't any solutions in this case. The only remaining case is what you have to prove, so we are done.
