Congruency application I want to prove whether the following is true using congruencies: If $n$ is odd and $3\not | n$, then $n^2\equiv 1\pmod{24}$.
I tried a direct proof.
Let $n=2k+1$ for an integer $k$ such that $3\not| n$, or $3c=n+r$ such that $r=1$ or $r=2$ for an integer $c$. Then in the first case, $3c=n+1$ implies $n\equiv 1\pmod 3$. Or in the second case, $3c=n+2$ implies $n\equiv 2 \pmod 3$. Then $$n^2\equiv 1 \pmod 3 \text{ or } n^2\equiv 4 \pmod 3$$
iff $$3|{n^2-1} \text{ or } 3|n^2-4$$
or $$8n^2\equiv8, 32 \pmod{24}$$
This was the farthest I got. I'm having a hard time going from mod 3 to mod 24 just given the conjunction that $n$ is odd and that $3\not| n$

It's the same as proving that $n^2-1 \equiv 0 \pmod 24$.
Since $n \equiv 1 \pmod 2 \implies (n-1)(n+1) \equiv 0 \pmod 8$ (as one of $n-1, n+1$ will be $2 \pmod 4 $ and the other will be $0 \pmod 4$)
and since $n \neq 0 \pmod 3$, one of $n-1,n+1$ must be $0\pmod 3 $ $\implies $(n-1)(n+1) \equiv 0 \pmod 3 $
$\implies n^2-1 \equiv 0 \pmod 24 \implies n^2 \equiv 1 \pmod 24$.
