Euler’s Theorem : Let n ≥ 1 n\ge 1 n ≥ 1 and let a ∈ Z a\in\mathbb{Z} a ∈ Z . If the greatest common divisor
of a a a and n n n is 1 1 1 (written gcd ( a , n ) = 1 \gcd(a,n)=1 g cd( a , n ) = 1 ), then
a φ ( n ) ≡ 1 ( m o d n ) , a^{\varphi(n)} \equiv 1 \pmod n, a φ ( n ) ≡ 1 ( mod n ) , where φ ( n ) \varphi(n) φ ( n ) is Euler’s totient function, defined by
φ ( n ) = ∣ { k ∈ { 1 , 2 , … , n } : gcd ( k , n ) = 1 } ∣ . \varphi(n)=\bigl|\{\,k\in\{1,2,\dots,n\}: \gcd(k,n)=1\,\}\bigr|. φ ( n ) = { k ∈ { 1 , 2 , … , n } : g cd( k , n ) = 1 } . As usual, x ≡ y ( m o d n ) x \equiv y \pmod n x ≡ y ( mod n ) means n n n divides x − y x-y x − y .
This follows immediately from Lagrange's theorem
applied to the group of units
( Z / n Z ) × (\mathbb{Z}/n\mathbb{Z})^\times ( Z / n Z ) × , a finite group
with ∣ ( Z / n Z ) × ∣ = φ ( n ) |(\mathbb{Z}/n\mathbb{Z})^\times|=\varphi(n) ∣ ( Z / n Z ) × ∣ = φ ( n ) . The special case n = p n=p n = p prime is Fermat's little theorem
.
Proof sketch (group-theoretic) : If gcd ( a , n ) = 1 \gcd(a,n)=1 g cd( a , n ) = 1 , then the residue class of a a a is an element of ( Z / n Z ) × (\mathbb{Z}/n\mathbb{Z})^\times ( Z / n Z ) × . In any finite group, x ∣ G ∣ = e x^{|G|}=e x ∣ G ∣ = e for all x ∈ G x\in G x ∈ G (by Lagrange), so a φ ( n ) ≡ 1 ( m o d n ) a^{\varphi(n)}\equiv 1 \pmod n a φ ( n ) ≡ 1 ( mod n ) .
Examples:
n = 10 n=10 n = 10 , a = 3 a=3 a = 3 : φ ( 10 ) = 4 \varphi(10)=4 φ ( 10 ) = 4 , and 3 4 = 81 ≡ 1 ( m o d 10 ) 3^4=81\equiv 1 \pmod{10} 3 4 = 81 ≡ 1 ( mod 10 ) .n = 12 n=12 n = 12 , a = 5 a=5 a = 5 : φ ( 12 ) = 4 \varphi(12)=4 φ ( 12 ) = 4 , and 5 4 = 625 ≡ 1 ( m o d 12 ) 5^4=625\equiv 1 \pmod{12} 5 4 = 625 ≡ 1 ( mod 12 ) .The hypothesis gcd ( a , n ) = 1 \gcd(a,n)=1 g cd( a , n ) = 1 matters: for n = 8 n=8 n = 8 , a = 2 a=2 a = 2 we have gcd ( 2 , 8 ) ≠ 1 \gcd(2,8)\ne 1 g cd( 2 , 8 ) = 1 , and indeed 2 φ ( 8 ) = 2 4 = 16 ≡ 0 ( m o d 8 ) ≠ 1 2^{\varphi(8)}=2^4=16\equiv 0 \pmod 8\neq 1 2 φ ( 8 ) = 2 4 = 16 ≡ 0 ( mod 8 ) = 1 .