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:
- If there is an element a with a^{n-1}\equiv 1\pmod n
but a^{(n-1)/\ell}\not\equiv 1\pmod n for every prime
\ell\mid n-1, then n is prime.
- Reason: those conditions force a to have order exactly
n-1, so the group has n-1 elements — which
only happens when n is prime.
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."
- Let E be an elliptic curve mod n,
P\in E a point, and q a prime with
q > (\,n^{1/4}+1)^2.
- Suppose q\mid m for the candidate order m,
and that the point satisfies
m\,P = \mathcal{O} while
(m/q)\,P \neq \mathcal{O}.
- Then n is prime.
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:
- If n is prime and can be written
4n = u^2 + D\,v^2 for a suitable discriminant
-D, then a curve with CM by
\mathbb{Q}(\sqrt{-D}) has order exactly
m = n + 1 - u (one of a few explicit choices of sign/pairing).
- So you first search small D until such a
u,v exist and the resulting candidate order
m = n+1-u factors as (small stuff) \times\; q
with q a probable prime above the Hasse bound.
- Only then do you build the actual curve, from the roots of the Hilbert class
polynomial H_D mod n, and pick a point
P.
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:
- Down-run (the hard part). Find E_1, P_1, m_1, q_1
with q_1\mid m_1, q_1>(n^{1/4}+1)^2, and the
point conditions. This certifies "n is prime if
q_1 is." Now repeat with n\leftarrow q_1 to
get q_2, and so on. Each step shrinks the number by roughly a constant
factor, so after O(\log n) steps you reach a small prime you can verify
outright.
- Up-run (verification, the easy part). The certificate is the list of tuples
(n_i, a_i, b_i, m_i, q_i, P_i). A checker validates each step
independently with a couple of curve multiplications — no searching, no factoring, no
point-counting. If every link holds and the last q is a verified small
prime, then by induction back up the chain, n is prime.
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:
| Method | Output | Guarantee | Speed in practice |
| Miller–Rabin | "probably prime" | probabilistic (error \le 4^{-k}) | fastest |
| AKS | proof (yes/no) | deterministic, proven polynomial | slow — rarely used |
| ECPP | proof + certificate | deterministic, heuristic time bound | fastest 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.