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$

If $n$ is odd and not divisible by $3$. Then $n \equiv \pm 1 \pmod{6}$.
$$n = 6k \pm 1$$
$$n^2 = 36k^2 \pm 12k + 1=12k(3k \pm 1) +1$$
We consider two cases if $k$ is even, then $12k(3k \pm 1)$ is divisible by $24$.
If $k$ is odd, then $3k\pm 1$ is even, hence $12k(3k\pm 1)$ is again divisible by $24$.
Hence $n^2 \equiv 1 \pmod{24}$.
