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$
 A: 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}$.
A: 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$.
A: Let $n$ $=$ $12k + r$ r is not equal to $2,4,6,8$ and $10$ since n is odd and r is not equal to $3$ since r is not divisible by $3$.
Therefore $r={1,5,7,11}$
$Case 1:$ $r = 1$
$n²= 144k²+24k+1$
→$n =24p + 1$  ,$∃p∈ℤ$
$Case 2:$ $r = 5$
$n²= 144k²+24⋅5k+25$
→$n²= 144k²+24k+24+1$
→$n =24p + 1$  ,$∃p∈ℤ$
$Case 3:$ $r = 7$
$n²= 144k²+24⋅7k+49$
→$n²= 144k²+24k+48+1$
→$n =24p + 1$  ,$∃p∈ℤ$
$Case 4:$ $r = 11$
$n²= 144k²+24k+121$
→$n²= 144k²+24⋅11k+120+1$
→$n =24p + 1$  ,$∃p∈ℤ$
Therefore $n^2 \equiv 1 \pmod{24}$.
