<s>[INST] Prove that $24|n^2-1$, if $(n,6)=1$ $n^2-1 = (n-1)(n+1)$
Then $24|(n-1)(n+1)$
$(n,6)=1$: $\exists a,b\in\mathbb{Z}$ that $n = 6\cdot a+b$
Investigate the residues, which arise when dividing the number n by two and three:
$\frac{6\cdot a+b}{3} = \frac{6\cdot a}{3}+\frac{b}{3} = 2\cdot a+\frac{b}{3}$
$\frac{6\cdot a+b}{2} = 3\cdot a+\frac{b}{2}$
Is this correct? How to prove it using resiudes? 
Thank You.
 [/INST] If $\gcd(n,6)=1$, then $n$ is odd and $n^2 \equiv 1 \bmod 8$.
If $\gcd(n,6)=1$, then $\gcd(n,3)=1$ and $n^2 \equiv 1 \bmod 3$.
Thus $24 = lcm(8,3)$ divides $n^2-1$.
</s>