Number Theory
Advanced
Fermat's Little Theorem
Holds when p is prime and gcd(a,p)=1.
Formula
Variables
aInteger
pPrime
Example
For p = 5, a = 2: 2⁴ = 16 ≡ 1 (mod 5). ✓
Did You Know?
Fermat's little theorem is a workhorse of primality testing and the RSA encryption that secures the web.