← back to Number Theory

Euler and Fermat

Jim Hefferon · Elementary Number Theory · Ch. 4

Euler's totient function counts how many integers below n are coprime to n. Fermat's little theorem and Euler's generalization connect this count to modular exponentiation: a^phi(n) ≡ 1 (mod n) whenever gcd(a, n) = 1.

Euler's totient function

phi(n) counts the integers from 1 to n that are coprime to n (share no common factor with n other than 1). For a prime p, phi(p) = p - 1. For a prime power, phi(p^k) = p^k - p^(k-1). For coprime m, n: phi(m n) = phi(m) phi(n).

phi(12): numbers coprime to 12 are highlighted 1 2 3 4 5 6 7 8 9 10 11 12 phi(12) = 4 (coprime: 1, 5, 7, 11)
Scheme

Fermat's little theorem

wpFermat's little theorem: if p is prime and gcd(a, p) = 1, then a^(p-1) ≡ 1 (mod p). Equivalently, a^p ≡ a (mod p) for all a. This is a special case of Euler's theorem.

Scheme
Neighbors