1. ## Proof involving primes

I need to show that if p is an odd prime not equal to 5, then either $\displaystyle p^2-1$ or $\displaystyle p^2+1$ is divisible by 10. It was trivial to show that they were both divisible by 2, so all that's left is to show one of them must be divisible by 5. I tried this a couple of different ways. First, I tried to assume one was not divisible by 5, and prove that the other one was. I also multiplied them together and tried to show that $\displaystyle p^4-1$ was divisible by 5, since there is a theorem that states if p is prime and p divides ab, then p divides a or p divides b. However, I got stuck using both methods. Any help would be greatly appreciated.

2. By Fermat's Little Theorem $\displaystyle a^{4}-1$ is divisible by 5, if $\displaystyle a$ is not divisible by 5

Fermat's Little Theorem states that:
Given a prime $\displaystyle p$ and a natural number $\displaystyle a$ coprime to $\displaystyle p$
$\displaystyle a^{p-1}\equiv{1}(\bmod.p)$

3. Consider the sequence of integers $\displaystyle p-2,p-1,p,p+1,p+2$. These are 5 consecutive integers, so exactly one of them is divisible by 5. Hence their product, which is $\displaystyle p(p^2-1)(p^2-4)$, is divisible by 5. But $\displaystyle p\ne5$. Therefore $\displaystyle (p^2-1)(p^2-4)$ is divisible by 5. Since 5 is prime, this means that one of $\displaystyle p^2-1$ and $\displaystyle p^2-4$ must be divisible by 5. In the latter case, $\displaystyle p^2+1=(p^2-4)+5$ is divisible by 5.

And as you’ve pointed out, they’re both divisible by 2; hence whichever of them is divisible by 5 is divisible by 10.

4. Examining every possible situation

$\displaystyle p^4-1=(p-1)\cdot(p+1)\cdot{(p^2+1)}$ (p is not 5)

Now $\displaystyle p=5\cdot{a}+b$ where $\displaystyle a$ and $\displaystyle b$ are natural numbers, $\displaystyle 1\leq{b}<5$

So $\displaystyle p^4-1=(5a+b-1)\cdot(5a+b+1)\cdot{(25a^2+5\cdot{ab}+b^2+1)}$

Now you have to show that one of this factors is divisible by five for b=1,2,3,4

Indeed if b=1, then 5a+b-1=5a which is divisible by 5

If b=2 then 25a²+5ab+2²+1= 25a²+5ab+5 also divisible by 5

If b=3 then 25a²+5ab+3²+1= 25a²+5ab+10 divisible by 5

If b=4 then 5a+b+1= 5a+5 divisible by 5

We have shown that $\displaystyle p^4-1$ is divisible by 5 whenever p is not divisible by 5