Let $p$ be prime not equal to 2 or 5. Show $p^2+1$ or $p^2-1$ is divisible by 10. I can do half the proof but can not think of a way to finish. If $p$ is prime then both $p-1$ and $p+1$ are even. In cases where either $p-1$ or $p+1$ is divisible by 5 that implies $(p-1)(p+1)=p^2-1=10n$ for some positive integer $n$. I am not sure if I am on the right track with this. 
 A: $p$ must equal $1,3,7,$ or $9$ mod $10$. But then $p^2$ must equal $1,9,9,$ or $1$ mod $10$.
A: Hint: It is obvious that both $p^2-1$ and $p^2+1$ are even. Can you show that $(p^2-1)(p^2+1)$ is divisible by $5$ when $p$ is not divisible by $5$?
A: Specialize $\,a,q = p,5\,$ below
Lemma $\ $  If $\,q=2k\!+\!1\,$ is prime and $\,(a,2q)=1\,$ then $\,2q\,$ divides $\,a^k-1\,$ or $\,a^k+1$
Proof $\ $ By Fermat $\, q\mid a^{q-1}\!-\!1= a^{2k}\!-\!1 = (a^k\!-\!1)(a^k\!+\!1)\ $ so $\,q\mid a^k\!-\!1\,$ or $\,q\mid a^k\!+\!1.\,$ Both are even since $\,a\,$ is odd, so one is divisible by $2$ and $q,\,$ so by $\,{\rm lcm}(2,q) = 2q,\,$ by $\,q\,$ odd.
A: Since $p \neq 5$ and $p$ is prime, $p$ cannot be divisible by $5$, so $p \neq 0 \mod 5$. Now,
$1^2 = 1 \mod 5$
$2^2 = 4 \mod 5$
$3^2 = 4 \mod 5$
$4^2 = 1 \mod 5$
That is, $p^2 \mod 5$ can be either $1$ or $4$. If $p^2=1\mod 5$, then $p^2-1=0\mod 5$. If $p^2=4\mod 5$,then $p^2+1=0\mod 5$. That is, either $p^2-1$ or $p^2+1$ is divisible by $5$. Since both are even, it implies that one of them that is divisible by $5$ is actually divisible by $10$.
A: Hint
Calculate $| \;\;p \;\; |\;\; p^2-1 \;\;|\;\; p^2+1\;\; \mod(10) $ in a table and discard $2,4,5,6,8,0$  you will see that just one could be $0 \mod(10)$ 
A: Here is another thought. Both expressions are clearly even, so you are only concerned about divisibility by $5$. Add $5p+5$ to each, which doesn't change divisibility by $5$ to obtain (modulo $5$) $$p^2+1\equiv (p+2)(p+3)$$$$p^2-1\equiv (p+1)(p+4)$$
Now one of these factors is divisible by $5$ because $p$ isn't.
A: If $p \equiv 3$ or $7 \pmod{10}$, then $p^2 \equiv 9 \pmod{10}$, so $p^2 + 1 \equiv 0 \pmod{10}$ as desired. But if $p \equiv 1$ or $9 \pmod{10}$, then $p^2 \equiv 1 \pmod{10}$, so $p^2 - 1 \equiv 0 \pmod{10}$ as desired.
Examples: $3^2 + 1 = 10$, $7^2 + 1 = 50$, $11^2 - 1 = 120$, $19^2 - 1 = 360$.
