# 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.

-
$n^2\equiv 1\pmod 8$ because the sum of three odd numbers is odd. – Ian Mateus Dec 28 '13 at 0:08
Oh, good point. I've edited the question. – user26486 Dec 28 '13 at 0:10
the significance of 3 is only that 3+3+3=9. which highlights the fact that the exponents are allowed to be 1. you need to deal with that...and 27+27+27 = 81. So, the real extra case is the three exponents equal.. – Will Jagy Dec 28 '13 at 0:13
@WillJagy The significance is actually that $8\nmid 3+1$. – user26486 Feb 12 '14 at 13:25

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.
When $p\equiv5\pmod 8$, then $p^k,p^l,p^m\equiv 1$ or $5\pmod 8$, because we don't know whether $k,l,m$ are even or odd. – user26486 Dec 28 '13 at 0:38
But I am working $\mod 4$ in that equation. and $1\equiv 5\mod 4$. – Ragnar Dec 28 '13 at 0:39