Theorem (Fermat-Euler theorem)

Let $x,n\in\Z_n$. If $\mrm{gcd}(x,n) = 1$, then $$x^{\phi(n)} \equiv 1 \mod n.$$

Proof