Fermat's Little Theorem
Problem
Find 2^100 mod 13 using Fermat's little theorem. Show the cyclic pattern of powers.
Explanation
Fermat's Little Theorem
If is a prime and is not divisible by , then:
This means always has remainder 1 when divided by . This is incredibly useful for computing large powers mod a prime.
Step-by-step: Find
Step 1 — Check conditions. is prime, and (2 is not divisible by 13). ✓
Step 2 — Apply Fermat's Little Theorem. (since ).
Step 3 — Express the exponent in terms of 12. , so:
Step 4 — Simplify using the theorem.
Step 5 — Reduce .
Verification: Computing . remainder . ✓ So .
The cyclic pattern of powers
The pattern repeats every 12 steps! This is what Fermat's theorem guarantees.
Why this matters
Without the theorem, computing would require calculating a 31-digit number. With the theorem, we reduce it to . This shortcut is essential in cryptography — RSA encryption relies on modular exponentiation with very large primes.
Try it in the visualization
Enter base and prime . The powers are computed mod , showing the cyclic pattern. The cycle always returns to 1 at , confirming Fermat's theorem.
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.