Fermat's Little Theorem
For prime p and a not divisible by p, a^(p-1) = 1 mod p.
Decision · step 7 of 8Multiples, Powers, Pascal: 3 to the 6 mod 7
3^6 = 5 x 3 mod 7 = 15 mod 7 = 1. Exponent 6 lands on 1, as Fermat promised.
What you will see
Powers of a mod p cycle back to 1 at exponent p - 1.
Cost
| Space | O(1) |
|---|
How you work with it here
play it through, step one change at a time, run it on your own input.
Screen readers: Numbers announce their value and role; each step announces the arithmetic performed.
Reduced motion: Values crossfade; no travelling digits.
Before this
Related
Taught by the same lesson
Multiples, Powers, Pascal covers these too, in the same run.