Show that if $p>5$ is prime, then $240 \mid (p^4-1)$ Show that if $p&gt;5$ is prime, then $240 \mid (p^4-1)$.
By Fermat's Little Theorem $p^4\equiv 1\pmod 5$ and $p^4\equiv \left( p^2\right)^2 \equiv 1^2\equiv 1\pmod 3$. Also $p^4-1=(p-1)(p+1)\left(p^2+1\right)$. Exactly one of $p-1, p+1$ is divisible by $4$, so $(p-1)(p+1)\left(p^2+1\right)$ is divisible by $4\cdot 2\cdot 2$.
$$240=3\cdot5\cdot16$$

Now using Carmichael function $\lambda(240)=\cdots=$lcm$(2,4,4)=4$

So, if $(p,30)=1,p^4\equiv1\pmod{240}$

$p$ does not need to prime