Skip to content
Infinitesimal Dynamics home
Notebook: 0 XP

Number Theory / Deeper structure

Primality Testing

How computers certify 600-digit primes in milliseconds without ever factoring anything.

3 min read · 1 sections · 1 checks

Contents 2 sections
  1. §1Testing with Fermat
  2. ?Check yourself

By the end you can

  • Explain the Fermat test and its weakness
  • Describe the Miller–Rabin test
  • Distinguish testing primality from factoring

Helps to know: Fermat, Euler and the Chinese Remainder Theorem

§1Testing with Fermat

If an−1≢1(modn)a^{n-1} \not\equiv 1 \pmod n for some aa, then nn is certainly composite, and we learn this without finding a factor. The trouble is Carmichael numbers such as 561561, which pass for every aa coprime to them.

Check yourself

  1. Q1
    If 2n−1≢1(modn)2^{n-1} \not\equiv 1 \pmod n, then nn is…