# If $p > 5$ is a prime number, then the last digit of $p^4-1$ is $0$.

If $p > 5$ is a prime number, then the last digit of $p^4-1$ is $0$ (ex.: $7^4-1=2400$). How do I prove this?

By noting that the last digit of the fourth powers of $1$, $3$, $7$ and $9$ is $1$ and that the last digit of every prime number $p> 5$ is $1$, $3$, $7$ or $9$.

More formally, $p=i\pmod{10}$ with $i$ in $\{1,3,7,9\}$ hence $p^4=i^4\pmod{10}$. Since every $i$ in $\{1,3,7,9\}$ is such that $i^4=1\pmod{10}$, this yields $p^4=1\pmod{10}$.

Use Fermat's Little Theorem and note that if the last digit of $x$ is $0$, then $x \mod 10 =0$.

Or do what Did suggests, that's also good.

For $p>5$, prime numbers can have a one's digit of $1,3,7$ or $9$. Now consider the multiplicative group $\Bbb{Z}_{10}^{\times}= \{1,3,7,9 \}$. The group has order $4$, meaning for any $x \in \Bbb{Z}_{10}^{\times}$, we know $x^4$ mod $10 \equiv 1$. By filling in a couple gaps, this should be enough to make your argument.

By Fermat theorem $$p^4\equiv1\pmod{5}\\p^4-1\equiv0\pmod{5}\\p^4\equiv1\pmod{2}\\p^4-1\equiv0\pmod{2}\\p^4-1\equiv0\pmod{10}$$ Since $p$ is odd so is $p^4$ clearly it gives $1$ as remainder by $2$.Also since $2$ and $5$ are co-prime we have that $0$ is remainder of $2\cdot 5$ which gives that the last digit is $0$

Just to note an alternative way through.

If $p\gt 5$ we have $(p,10)=1$

By Fermat-Euler, and noting that $\varphi(10)=4$, we have that if $(p,10)=1$ then $p^4\equiv 1 \mod 10$

If ${p^4}$ is ending on $1$, then ${p^4} - 1$ will end on $0$. Hence we need to show that for all $p > 5,\,\,\,{p^4} \equiv 1\,(\bmod \,10)$. According to Euler theorem if $p$ and $10$ are relatively prime the congruence ${p^{\varphi (10)}} = {p^4} \equiv 1\,(\bmod \,10)$ holds. Any primes greater than $5$ will always be coprime with $10$. This shows that for all $p > 5,\,\,\,{p^4} - 1 \equiv 0\,(\bmod \,10)$ is true.