1. Proof involving primes

I need to show that if p is an odd prime not equal to 5, then either $p^2-1$ or $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 $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 $a^{4}-1$ is divisible by 5, if $a$ is not divisible by 5

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

3. Consider the sequence of integers $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 $p(p^2-1)(p^2-4)$, is divisible by 5. But $p\ne5$. Therefore $(p^2-1)(p^2-4)$ is divisible by 5. Since 5 is prime, this means that one of $p^2-1$ and $p^2-4$ must be divisible by 5. In the latter case, $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

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

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

So $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 $p^4-1$ is divisible by 5 whenever p is not divisible by 5