I would like to prove the equivalence of the two most common definitions of Carmichael numbers : $a^n \equiv a \mod n \iff a^{n-1} \equiv 1 \mod n$ for all $n$ such that $\mathrm{gcd}(a,n)=1$
I do not see how to prove the right-to-left statement when $\mathrm{gcd}(a,n) \ne 1$. Of course if $n$ divides $a$, this is obvious since both terms are 0.
I would like to use the chinese remainder theorem to try to bring back the problem for a prime exponent $n = p^e$ (since I don't know yet $n$ must be square-free), but $a^n \equiv 1 \mod p^e$ is not a very helpful equation.
Every article on the web says it is obvious, but not for me. Can you help me ?