I have an assignment and one of the questions is this: if $n$ is a natural number, prove that if $n$ is not divisible by $2$ & $3$ (which means that it is not divisible by $6$) then $n^2 + 23$ is divisible by $24$.
Here is my approach : if $n^2 + 23$ is divisible by $24$, then for sure $n^2$ % $24$ should be equal to $1$, so I set $n=6k+1$, which is a number that is surely not divisible by $2$ or $3$, so $(6k+1)^2 $ % $ 24$ is supposed to be equal to $1$. But for some reason I just got stuck in that equation; is there something wrong that I am doing here? or is my approach right?
If $n$ is not divisible by $2$ or $3$, then $n=6k\color{red}\pm1$.
$(6k\pm1)^2=36k^2\pm12k+1=12k(3k\pm1)+1.$
Can you show $k(3k\pm1)$ is divisible by $2$ for all $k\in\mathbb Z$?