Skip to content

After the Riemann Hypothesis · result 17 of 48 · Algorithms

Miller’s test: a primality test with no luck in it

A number n is prime exactly when it passes one short test for every base up to 2 · (ln n)².

Now a theoremDirichlet L-functionsWork left: 0 · Done

Miller’s test, run in your browser. Type a whole number of up to 40 digits. The answer is a proof either way: a base that exposes the number, or every base up to 2 · (ln n)² passed.

The idea

Fermat’s little theorem says that if n is prime then a^(n−1) leaves remainder 1 on division by n, for any base a. Composite numbers usually fail this, so it makes a quick test. Miller’s version looks a little harder at the same calculation and catches more. For any composite n, at least three bases in four expose it.

Used with random bases this is the Miller–Rabin test, which every computer uses. It can say “composite” with certainty, but “prime” only with overwhelming probability. Miller’s original point in 1976 was different: if the hypothesis for Dirichlet L-functions holds, some small base always exposes a composite number, so trying every base up to a fixed limit is a proof. Bach found the limit: 2 · (ln n)².

The reason is the item on this list about the smallest non-square modulo p. The bases that fail to expose n form a tidy group, and the hypothesis forces a small number to lie outside it.

Where it stands

Before
Gary Miller showed in 1976 that, if the hypothesis holds for Dirichlet L-functions, a number n is prime exactly when it passes a short test for every base up to a limit. Eric Bach made the limit exact in 1990: every base up to 2 · (ln n)².
What the proof means for it
Now a theorem A theorem. Miller’s test is a proof of primality, not a test that is right with high probability.
Open work to be done
In practice little changes. A test that needs no hypothesis has existed since 2002 (Agrawal, Kayal and Saxena), and for big numbers other methods are faster. For the 13,017-digit prime on our own pages Miller’s test would need about 1.8 billion bases, centuries of computing on one processor; the certificate that proved it took five and a half days.
Difficulty of that work
0 · Done Nothing left to prove. The statement is now simply true. (Our own rough estimate.)

What we did

A working prover. The box above is Miller’s test as a proof, with Bach’s limit. It starts with 14,449,613,517,291,620,243, the last number in the certificate of our 13,017-digit prime; that one needs every base up to 3,892.

It is a demonstration. For numbers of thousands of digits other proofs are much faster, as the page on our prime explains.

What it rests on

This result needs the first two boxes, and both are proved. Outlined boxes are the ones it uses.

More results

← The first prime in a progression The list of all 48The smallest number that is not a square modulo p →

Notes and sources

  • Source for the statements on this page: G. Miller, J. Comput. System Sci. 13 (1976); E. Bach, Math. Comp. 55 (1990).
  • On this site: The proof of our 13,017-digit prime.
  • The figure is computed in your browser from first principles each time the page loads. It illustrates the statement; it does not prove it.
  • What was proved and certified in November 2026, what it covers and what it does not: After the Riemann Hypothesis. This page is a summary for general readers.

← Back to After the Riemann Hypothesis