a divisibility problem if $a$ is an integer , such that it is not divisible by 2 or 3, prove that $ 24 $ divides $ a^2+ 23$ . 
I took cases ,case $1$ : when $a$ is divisible by only $2$ and not $3$ then we can write  $a = 6k+2, 6k+4 $ and case 2: when $a= 6k+3$ and here $a$ is divisible by only $3$ and not $2$. 
and then in each case,    
I substituted values of $a$ in $a^2+23$ , but got nothing. I do think my case by- case analysis here is wrong, but surely I'm missing something .
please help by suggesting how can I improve my solution. No need to give me an elegant solution, only a few hints will be fine.
 A: Method $1:$
HINT:
Using Carmichael Function, $\lambda(24)=2$
If $(a,2)=(a,3)=1, (a,2^m\cdot3^n)=1$ for any integer $m\ge0,n\ge0$
So, $a^2\equiv1\pmod{24}$ if $(a,24)=1$
Now, $a^2+23\equiv a^2-1\pmod{24}$
Method $2:$ 
If $(a,3)=1, a\equiv\pm1\pmod 3$
$\implies a^2\equiv1\pmod 3\implies a^2+23\equiv24\pmod{3}\equiv0$
If $(a,2)=1, a=2b+1$(say),
$a^2=(2b+1)^2=8\frac{b(b+1)}2+1\equiv1\pmod 8$
$\implies a^2+23\equiv1+23\pmod 8\equiv 0$
So, $a^2+23$ is divisible by $3,8$ so will be divisible by lcm$(3,8)=24$
Method $3:$
HINT:
$$a^2+23=(a-1)(a+1)+24$$
Observe that $(a-1)a(a+1)$ being a product of $3$ three consecutive integers must be divisible by $3$
But as $(a,3)=1\implies 3$ divides $(a-1)(a+1)$
Again, as $(a,2)=1, a\pm1$ are even, one of them will be divisible by $2$, the other by $4$
$\implies 2\cdot4$ divides  $(a-1)(a+1)$
So, $(a-1)(a+1)$ is divisible by lcm$(3,8)=24$
A: If a does not divide neither 2 nor 3, it does not divide 6. So , working with k, we see a must be of one of the forms $6k+1$ , or $6k-1$ , since $6k+2=2(3k+1), 6k+4=2(3k+2)$, etc.
Consider the first case, $a=6k+1$; then:
$a^2+23=(6k+1)^2+23=36k^2+12k+1+23=36k^2+12k+24=12k(3k+1)+24$ . But$k$ and $3k+1$ will
always have different parity, i.e., if $k$ is even, then $3k+1$ is odd--and viceversa.  So we have the cases:
1)If $k$ is even, we're done, since then:
$12k(3k+1)+24=12(2k')(3k+1)=24k'(3k+1)+24$
2)If $k$ is odd, then $3k+1$ is even, say $3k+1=2k''$, then:
$12k(3k+1)+24=12k(2k'')+24=24kk''+24$
The case for a=6k-1 is similar.
