n is a prime number.
Prove :
$\displaystyle \begin{array}{l}
\forall n \in {\rm N}:n \ge 5 \\
n^2 - 1 \equiv 0\left[ {\bmod 24} \right] \\
\end{array}$
Since $\displaystyle n$ is odd we have that $\displaystyle n-1$ and $\displaystyle n+1$ are consecutive-evem numbers -they differ in 2-, so one of them must be divisible by at 2 -and not 4- and the other divisible by at least 4, thus, since $\displaystyle n^2-1=(n-1)(n+1)$ , we must have that$\displaystyle n^2-1$ is a multiple of 8.
On the other hand, since 3 doesn't divide $\displaystyle n$ - because n is a prime greater than 4 - either $\displaystyle n=3k+1$ or $\displaystyle 3k-1$ for some k in $\displaystyle \mathbb{Z}$ thus $\displaystyle 3|(n-1)$ or $\displaystyle 3|(n+1)$ hence $\displaystyle 3|(n^2-1)$
Now, since 3 and 8 divide $\displaystyle n^2-1$ , and 3 and 8 are coprime, then $\displaystyle (3\cdot 8)|(n^2-1)$ i.e. $\displaystyle 24|(n^2-1)$