Euler's theorem. Let n1n\ge 1 and aZa\in\mathbb Z. If the of aa and nn is 11, then

aφ(n)1(modn),a^{\varphi(n)}\equiv 1\pmod n,

where Euler's totient function is

φ(n)={k{1,,n}:gcd(k,n)=1}.\varphi(n)=\bigl|\{k\in\{1,\dots,n\}:\gcd(k,n)=1\}\bigr|.

Here xy(modn)x\equiv y\pmod n means that nn divides xyx-y.

Remarks

This follows from applied to the (Z/nZ)×(\mathbb Z/n\mathbb Z)^\times, whose order is φ(n)\varphi(n). The case in which n=pn=p is prime is .

Examples
  • For n=10n=10 and a=3a=3, φ(10)=4\varphi(10)=4 and 34=811(mod10)3^4=81\equiv1\pmod {10}.
  • The coprimality hypothesis is essential: 2φ(8)=240(mod8)2^{\varphi(8)}=2^4\equiv0\pmod 8.