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.

Given $n-1, n, n+1$ and $n+2$ then $2$ divides two of them and $4$ divides one of them and $8$ divides the product $(n-1)n(n+1)(n+2)$.  If $n$ is odd then we know the two that $2$ and $4$ divides must be $n-1$ and $n+1$ and that $8$ divides the product $(n-1)(n+1)$.
Given $n-1, n , n+1$ then $3$ divides exactly one of them.  If $3\not \mid n$ then $3$ divide either $n-1$ or $n + 1$ so $3|(n+1)(n-1)$.
So if $n$ is odd and $3 \not \mid n$, then $3*8|(n+1)(n-1)$.
That will be the case if $\gcd(n,6) = 1$.  So if $\gcd(n,6) =1$ then $n$ is odd and $3\not \mid 6$ and so $24 = 3*8|(n+1)(n-1) = n^2 - 1$.
......
Using residues:
$\gcd(n,6) = 1$ so $\gcd(2, n) = 1$ so $\gcd(8^n, 1) $ so $n \equiv 1, 3,5, 7 \equiv \pm 1, \pm 3\mod 8$.  So $n^2 \equiv 1, 9\equiv 1 \mod 8$.
$\gcd(n,6) = 1$ so $\gcd(3, n) =1$ so $n \equiv \pm 1 \mod 3$.  So $n^2 \equiv 1 \mod 8$.
So $n^2 -1 \equiv 0 \mod 3$ and $n^2 -1 \equiv 0 \mod 8$.
So $3|n^2 - 1$ and $8|n^2 -1$ and $24|n^2 - 1$.
