Prove for all odd $n \in \mathbb{Z}$: $a^{3(n+1)^2+1} \equiv a$ mod $21$.
I started this way: $21 = 3*7$ and $gcd(3,7) = 1$. So \begin{cases} x \equiv a^{3(n+1)^2+1} \, \text{mod} \, 7 \\ x \equiv a^{3(n+1)^2+1} \, \text{mod} \, 3 \end{cases} I was trying to use following theorem to solve the equation with mod $3$: $a^p \equiv a$ mod $p$ with $p$ a prime number. But I have no idea how to solve the first equation (the one with mod $7$) and how to prove that $n$ has to be an odd number.
Thanks in advance!