Remainders • Topic 3 of 3

Wilson & Fermat

Three named theorems turn nightmarish exponents and factorials into 1. Fermat’s little theorem: for a prime p and a not divisible by p, a^(p−1) ≡ 1 (mod p) — so reduce the exponent mod (p−1) before computing. Euler’s theorem generalises this to any modulus n coprime to a: a^φ(n) ≡ 1 (mod n), where φ(n) counts integers below n that are coprime to n (φ(p) = p−1, φ(p^k) = p^k − p^(k−1)). This is the standard tool for "last two digits" (mod 100, φ(100) = 40). Wilson’s theorem handles factorials: for a prime p, (p−1)! ≡ −1 (mod p), and its corollary (p−2)! ≡ 1 (mod p). The make-or-break condition for Fermat and Euler is coprimality — if a shares a factor with the modulus, neither applies, and you must split using the Chinese Remainder idea or reduce directly. Reduce the exponent first; only then apply the theorem.

✅ Solved examples

1. Find the remainder when 3^100 is divided by 7 (Fermat).
p = 7 prime, gcd(3,7)=1 ⇒ 3^6 ≡ 1 (mod 7). 100 mod 6 = 4, so 3^100 ≡ 3^4 = 81 ≡ 4 (mod 7). Remainder = 4.
2. Find the last two digits of 7^2024 (Euler).
Last two digits = value mod 100. gcd(7,100)=1, φ(100) = 100(1−1/2)(1−1/5) = 40 ⇒ 7^40 ≡ 1 (mod 100). 2024 mod 40 = 24, so need 7^24 mod 100. 7^4 = 2401 ≡ 1 (mod 100), and 24 mod 4 = 0 ⇒ 7^24 ≡ 1 (mod 100). Last two digits = 01.
3. Find the remainder when 16! is divided by 17 (Wilson).
p = 17 prime ⇒ (17−1)! = 16! ≡ −1 (mod 17). Standard remainder = −1 + 17 = 16.
4. Find the remainder when 15! is divided by 17 (Wilson corollary).
p = 17 prime ⇒ (p−2)! = 15! ≡ 1 (mod 17). Remainder = 1. (Check: 16! ≡ −1 and 16! = 16 × 15! ≡ (−1)×15!, so (−1)×15! ≡ −1 ⇒ 15! ≡ 1.)

✏️ Practice — try these, take hints as needed

1. Remainder when 2^90 is divided by 11 (Fermat).
11 is prime ⇒ 2^10 ≡ 1 (mod 11).
90 mod 10 = 0.
Exponent reduces to 0 ⇒ 2^0.
1
2. Remainder when 10! is divided by 11 (Wilson).
11 is prime.
(11−1)! = 10! ≡ −1 (mod 11).
Convert −1 to positive.
10
3. Remainder when 5^60 is divided by 13 (Fermat).
13 prime ⇒ 5^12 ≡ 1 (mod 13).
60 mod 12 = 0.
5^0 = 1.
1
4. Last two digits of 3^400 (Euler).
Work mod 100; gcd(3,100)=1.
φ(100) = 40 ⇒ 3^40 ≡ 1 (mod 100).
400 mod 40 = 0.
01
5. Remainder when 11! is divided by 13 (Wilson corollary).
13 is prime.
(13−2)! = 11! ≡ 1 (mod 13).
Corollary of Wilson.
1

📝 Topic test — 8 questions

Auto-graded with full solutions; saved to your dashboard. Use the calculator and formula sheet (top-right) any time.

Loading questions…