<s>[INST] Proof using Mod How can you prove that: 
$$a^7\equiv a\:(\text{mod } 42)$$
I haven't been given any other information other than to use Fermat's theorem. 
 [/INST] There are two versions of Fermat's Theorem. 
Version $1$: If $a$ is not divisible by $p$, then $a^{p-1}\equiv 1\pmod{p}$.
Version $2$: For any $a$, $a^p\equiv a\pmod p$.
The more common version is Version $1$. From it, you can easily deduce Version $2$. For if $a$ is not divisible by $p$, then $a^{p-1}\equiv 1\pmod{p}$. Multiplying by $a$, we get that $a^p\equiv  a \pmod{p}$. On the other hand, if $a$ is divisible by $p$, we have that both $a^p$ and $a$ are congruent to $0$ modulo $p$, and therefore are congruent to each other.
We omit the proof that Version $2$ implies Version $1$. It is straightforward.
Using Version $2$, we find that for all $a$,
$$a^7 \equiv a\pmod{7}.\tag{$1$}$$
Now work modulo $2$. It is hardly necessary to use machinery. If $a$ is odd, then so is $a^7$, and if $a$ is even, then so is $a^7$.  We conclude that for all $a$, 
$$a^7 \equiv a\pmod{2}.\tag{$2$}$$
Now work modulo $3$. We can do a three-cases verification that $a^7\equiv a\pmod{3}$ for all $a$. Or else we can use Fermat's Theorem. If $a$ is divisible by $3$, then $a^7$ and $a$ are congruent to $0$ modulo $3$, so they are conruent to each other. If $a$ is not divisible by $3$, then $a^2\equiv 1\pmod{3}$, and therefore $a^6\equiv 1\pmod{3}$, and therefore $a^7\equiv a \pmod{3}$. we conclude that for all $a$
$$a^7 \equiv a\pmod{3}.\tag{$3$}$$
So $7$, $2$, and $3$ each divide $a^7-a$. Since they are pairwise relatively prime, it follows that their product $42$ divides $a^7-a$ for all $a$. This is what we wanted to prove. 
</s>