Given $2^7 \equiv 2 \mod n$ and $3^7 \equiv 3 \mod n$, prove for all $a$ in $\mathbb{Z}$: $a^7 \equiv a \mod n$ Let $n$ be a positive whole number. Given $2^7 \equiv 2 \mod n$ and $3^7 \equiv 3 \mod n$, prove for all $a$ in $\mathbb{Z}$:  $a^7 \equiv a \mod n$, without using a computer.
$n$ must be greater than 3 and less than $2^6=64$, so using a computer it is easy to verify that $n$ must be 6,7,14,21 or 42.

Using Fermat's Little Theorem, 
$$a^7\equiv a\pmod7$$
$$a^7-a=a(a^6-1)=a(a-1)\{a^5+a^4+\cdots+a+1\}$$ where by Little Theorem, $\displaystyle2|a(a-1)$
$$a^7-a=a(a^6-1)=a(a^2-1)(a^4+a^2+1)=(a^3-a)(a^4+a^2+1)$$ where by Little Theorem, $\displaystyle3|(a^3-a)$
So, $\displaystyle a^7-a$ will be divisible by lcm$(2,3,7)$
