Number Theory
Math · Foundational · Lesson 7 of 9

Fermat’s Little Theorem

Powers that come back to 1

An interactive lesson with 6 steps, about 5 minutes: you predict, drag and solve, with instant feedback on every answer. It runs in your browser and needs JavaScript.

What you’ll learn

  • Fermat: for prime pp and aa not divisible by pp, ap−1≡1(modp)a^{p-1} \equiv 1 \pmod p.
  • Reduce huge exponents mod p−1p - 1.
  • Failing the Fermat test proves a number is composite.

Steps

  1. A surprising pattern
  2. Powers around a clock
  3. A big power, quickly
  4. Using Fermat
  5. Shrinking a huge power
  6. A primality test