Elliptic-Curve Primality Proving

A Miller–Rabin test can tell you a 1000-digit number is prime with a failure chance below 10^{-30} — but it never hands you a proof. It is a very confident witness, not a certificate you could take to court. Now imagine you have just found a record 50000-digit prime and you want the rest of the world to check that it really is prime, quickly, without re-running your months of computation. You want a short document — a primality certificate — that anyone can verify in minutes.

Elliptic-Curve Primality Proving (ECPP) is the method that produces exactly that. It is the fastest general-purpose way we have to prove (not merely to bet, as Miller–Rabin does, and not merely to decide slowly, as the polynomial-time AKS test does) that an arbitrary large number is prime — and it leaves behind a certificate that is short and cheap to re-check. It is the tool behind essentially every record "ordinary" (non-special-form) prime of tens of thousands of digits.

What is a primality certificate?

A certificate is data C attached to a number n such that checking "C proves n is prime" is much faster than discovering the proof was. It is the primality analogue of the gap between finding a hard proof and reading it. In complexity language, primality lies in \mathsf{NP} (an easy-to-check certificate of primality exists) — and, since composites are easy to certify too, in \mathsf{NP}\cap\mathsf{coNP}.

The oldest example is the Pratt certificate (1975), built from a converse of Fermat's Little Theorem due to Lucas. It rests on a fact about the group (\mathbb{Z}/n\mathbb{Z})^\times:

To use it you must know the prime factorisation of n-1 — and each prime \ell\mid n-1 must itself be certified prime, recursively. The certificate is therefore a tree: n points to the primes of n-1, each of those points to the primes of its predecessor, and so on down to tiny primes checked by hand. Verifying it is just a handful of fast modular exponentiations at each node.

The catch is fatal in general: you must factor n-1, and factoring a random large number is exactly the problem believed to be hard. For a special n (like a 2^p-1 Mersenne, where n-1 is a pure power of two) this is wonderful; for a random prime it is a dead end. ECPP is the escape.

The elliptic-curve idea: replace one group with a menu of groups

Lucas' test — and its more flexible cousin, the Pocklington test, which only needs a partial factorisation of n-1 — both live inside the single fixed group (\mathbb{Z}/n\mathbb{Z})^\times, whose size is forced to be n-1. You are stuck with whatever n-1 happens to factor into. That is the whole limitation.

Goldwasser and Kilian (1986) had the liberating idea: work instead in the group of points of an elliptic curve

E:\; y^2 = x^3 + ax + b \pmod n.

If n is prime, the points of E form a finite abelian group whose size m = \#E(\mathbb{F}_n) lies, by Hasse's theorem, in the narrow window

n + 1 - 2\sqrt{n} \;\le\; m \;\le\; n + 1 + 2\sqrt{n}.

The key freedom: as you vary the coefficients a, b you get different curves with different orders m scattered across that Hasse interval. Instead of being handed n-1 and forced to factor it, you can hunt for a curve whose order m is easy to factor — one with a large prime factor. This is the elliptic-curve analogue of the n-1 test, and the menu of groups is what makes it work for every n.

The Goldwasser–Kilian theorem

Here is the engine. It converts "I found a good point on a good curve" into "n is prime, provided q is."

Read it as a downward implication: primality of n is reduced to primality of the smaller number q. The bound q>(n^{1/4}+1)^2 is what guarantees the reduction is strict — it forces q to be genuinely smaller than n (roughly q) yet still larger than \sqrt n, so the recursion terminates. The condition (m/q)P\neq\mathcal O plays exactly the role of "a^{(n-1)/\ell}\neq 1" in Lucas' test: it certifies that the point P has order divisible by the large prime q, which cannot happen if n were composite (a composite n would make E not even a group).

So one certificate step is the tuple (n,\,a,\,b,\,m,\,q,\,P). Verifying it means: check q\mid m, check q>(n^{1/4}+1)^2, and do two elliptic-curve scalar multiplications to confirm mP=\mathcal O and (m/q)P\neq\mathcal O. All fast. Then recurse on q.

Atkin–Morain: use complex multiplication to choose the order

Goldwasser–Kilian is beautiful but has a slow heart: to learn each curve's order m you must count points on E (via Schoof's algorithm), then hope the resulting m factors nicely — and if it doesn't, throw the curve away and count again. Point-counting is the expensive step, and you pay it repeatedly.

Atkin and Morain (1993) turned the search inside out. Their method — the one meant by "ECPP" today — uses the theory of complex multiplication (CM) to build a curve whose order is known in advance, so no point-counting is needed. The idea:

You have swapped "make a curve, then count its order" for "pick the order you want, then make the curve." The costly point-counting vanishes; the price is finding a good discriminant, which is cheap. That single reversal is why ECPP is fast in practice.

The worked structure: a downward recursion

ECPP proves n prime by producing a chain, not a tree (each step needs just one smaller prime q, unlike Lucas' several \ell):

n \;\longrightarrow\; q \;\longrightarrow\; q' \;\longrightarrow\; q'' \;\longrightarrow\; \cdots \;\longrightarrow\; \text{(small prime, checked directly).}

Concretely, to certify n:

The certificate has O(\log n) steps, each of size O(\log n) bits of data, so the whole document is O((\log n)^2) bits — kilobytes even for a huge prime — and verification is about O((\log n)^3) work. That asymmetry, slow to find, fast to check, is precisely what "certificate" means.

How fast, and how it compares

Finding the certificate — mostly the discriminant search and factoring each candidate order — costs heuristically about

\tilde{O}\big((\log n)^4\big)

bit operations (with variants shaving this toward (\log n)^{3+\varepsilon}). In practice ECPP is the fastest general-purpose primality proof, routinely certifying primes of tens of thousands of digits, with the record "ordinary" proven prime well past 50000 digits. Place it against its neighbours:

MethodOutputGuaranteeSpeed in practice
Miller–Rabin"probably prime"probabilistic (error \le 4^{-k})fastest
AKSproof (yes/no)deterministic, proven polynomialslow — rarely used
ECPPproof + certificatedeterministic, heuristic time boundfastest proof

The trade-off is sharp. Miller–Rabin is the fastest but only ever says "probably." AKS is the only one whose running time is a proven theorem, but it is far too slow for record work. ECPP gives a real proof and a re-checkable certificate at high speed — at the cost that its speed is only a heuristic expectation, not a proven bound.

Two things about ECPP trip people up.

First, ECPP genuinely PROVES primality. Unlike Miller–Rabin, a completed ECPP run is not "probably prime" — it is a deductive certificate: if every link of the chain checks out and the final small prime is verified, n is prime, full stop. The probabilistic flavour appears only inside the search (you use Miller–Rabin to guess which candidate q is worth pursuing), but the final certificate stands on the rigorous Goldwasser–Kilian theorem, not on any probability.

Second, "proof" refers to the OUTPUT, not the RUNNING TIME. What ECPP does not have is a proven bound on how long it takes to find the certificate. The \tilde O((\log n)^4) figure is heuristic — it assumes candidate orders m=n+1-u behave like random numbers of their size, so that one with a large prime factor turns up quickly. No one has proven this always happens (a pathological n could, in principle, resist for a long time). The recursion also relies on each successive q being itself factorable/certifiable — which is exactly what the next step arranges, but the chain only exists because a good curve is found at every level. Contrast AKS, whose polynomial running time is a theorem. So: ECPP's answer is rigorous; ECPP's speed is only expected.

The trick that makes Lucas/Pocklington work is that a group of prime order q can only sit inside E(\mathbb F_n) when n is prime. Any family of groups whose sizes you can (a) predict and (b) vary would do — but elliptic curves are the sweet spot. Their orders sweep across the whole Hasse interval [n+1-2\sqrt n,\,n+1+2\sqrt n] as you change a,b, giving you many independent chances to land a smooth-enough order; the group law is cheap to compute; and complex multiplication lets you prescribe the order rather than discover it. Multiplicative groups give you only n-1 — one fixed, un-negotiable size. Adding a second "knob" (the curve) is the entire gain. This same richness — many curves, tunable orders — is why elliptic curves also power the fastest factoring method (Lenstra's ECM) and, via their L-functions, sit at the centre of modern number theory.