$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.
If $\gcd(n,6)=1$, then there is some integer $k$ such that $n=6k\pm 1$. We compute $$n^2-1=(6k\pm 1)^2-1 = 36k^2\pm 12k = 12k (3k\pm 1)$$
Now, if $k$ is even, then $24|12k$ already. If instead $k$ is odd, then $3k\pm 1$ is even, so again $24|12k(3k\pm 1)$.