Math · Advanced · Lesson 7 of 7
Testing for Primes
Liars, Carmichael numbers and Miller–Rabin
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 test: if , then is composite.
- Pseudoprimes and Carmichael numbers (561, 1105, 1729) can fool it.
- Miller–Rabin also checks square roots of 1, so each base catches a composite with probability at least 3/4.
Steps
- Trial division
- Fermat liars
- Carmichael numbers
- Korselt’s recipe
- A fake square root
- Finding an RSA prime