Deterministic construction of an n-bit prime in time polynomial in n (current best 2n/2+o(n))
On this page16 sections
Difficulty 76: a concrete derandomisation target that has resisted strong teams (Polymath4) and sits against the square-root barrier of analytic number theory; the 2023 pseudodeterministic construction shows progress on a weaker notion, but a deterministic polynomial-time algorithm still needs either Cramér-level prime gaps or a derandomisation of BPP-type strength. Application value 6: marginal, since random primes are used in practice. Leverage 30: limited to derandomisation theory and analytic number theory.
The problem
Without using any randomness, can a computer quickly produce a big prime number whenever you ask?
- 1Random guess then test finds primes fast
- 2Can we avoid randomness entirely?
- 3Best proven recipe takes about √N time
- 4Polymath4 tried and fell short
- 5Open: fast fixed recipe for primes
The problem. Given , output a prime in by a deterministic algorithm. A randomised algorithm picks random integers and tests primality (Miller–Rabin, or deterministically by Agrawal, Kayal and Saxena, 2004). By the prime number theorem the density of primes near is about , so the expected running time is . Is there a deterministic algorithm running in time , i.e. ?
The best unconditional algorithm takes time, exponential in . The problem is a clean test case for derandomisation: a search problem in a dense set, where the density is known and primality testing is already deterministic.
State of the art.
- Brute-force testing of every number in the interval takes time.
- Odlyzko and Lagarias–Odlyzko (analytic methods for computing the prime counting function ) find a prime in in time. This is the best known unconditionally.
- The Polymath4 project (2009-10; Tao, Croot, Helfgott and others) aimed to beat the square-root barrier, obtaining partial results such as computing the parity of the number of primes in an interval in about the same time, but did not break the barrier. Its write-up appeared in Mathematics of Computation (2012).
- Under the Riemann Hypothesis, prime gaps are at most about , which gives the same exponent. Cramér's conjecture (gaps of size about ) would give polynomial time but is unproven. A full derandomisation of BPP, which would follow from strong circuit lower bounds, would also give a polynomial-time algorithm.
- Chen, Lu, Oliveira, Ren and Santhanam (2023) gave a randomised algorithm that, for infinitely many lengths , outputs one fixed prime with high probability (a "pseudodeterministic" construction). Making it work for every , and removing the randomness, remain open.
Connections. Derandomising polynomial identity testing is related, and a general theory of pseudorandomness (hardness versus randomness) would give deterministic constructions of objects that random choice produces easily, including primes, if strong circuit lower bounds hold. So a proof from complexity assumptions is plausible, but the unconditional statement is open.
Why it is hard. Primes are defined multiplicatively and appear additively spread out; no known method guarantees one in a short interval short of the square-root length, except by counting. Any approach must either count primes faster or understand their distribution in short intervals far better than known.
Payoff. Mostly theoretical; it would be a landmark in derandomisation and would likely need new ideas in number theory.
Go deeper
The full technical text.
Given , output a prime in by a deterministic algorithm. A randomised algorithm picks random integers and tests primality (Miller–Rabin, or deterministically by Agrawal–Kayal–Saxena, 2004): its expected running time is because primes have density . Is there a deterministic algorithm running in time , i.e. ? The best unconditional algorithm takes time, exponential in . The problem is a clean test case for derandomisation: it is a search problem in a dense set whose density is known.
Words on this page (12)
- prime number
- A whole number greater than 1 divisible only by 1 and itself.
- primality test
- A method for deciding whether a given number is prime.
- AKS primality test
- The 2002 method that proved primality can be decided deterministically in polynomial time.
- Miller–Rabin test
- A fast randomised primality test that is wrong with a tiny, controllable probability.
- derandomization
- Replacing a method that uses random choices with a deterministic one of similar speed.
- deterministic algorithm
- A method with no random choices that always behaves the same on the same input.
- polynomial time
- Running time growing like a fixed power of the number of digits.
- Riemann Hypothesis
- A famous unproven claim about the zeros of the zeta function, with deep consequences for how primes are distributed.
- prime gap
- The distance between one prime and the next.
- prime number theorem
- The theorem that near a large number N about one number in every ln N (natural logarithm) is prime.
- Cramér's conjecture
- An unproven guess that gaps between consecutive primes are at most about the square of the logarithm of their size.
- pseudodeterministic algorithm
- A randomised algorithm that, with high probability, outputs the same fixed answer every time it is run.
New to this? Read first (3)
- Primality test (Wikipedia)Shows how primes are tested, randomised and deterministic.
- AKS primality test (Wikipedia)The landmark deterministic test that makes the construction problem the remaining gap.
- Derandomization (Wikipedia)The general question this problem exemplifies.
Path to understanding
foundations → problemThe research entries this problem rests on, in the order to read them. Each links to its explainer.
- Start with
- Step 2
- Computational complexity theoryTheory · host
- Then
- Deterministic construction of an n-bit prime in time polynomial in n (current best 2n/2+o(n))The problem
State of the art
Best known. Brute-force testing takes . The unconditional state of the art, due to Odlyzko and Lagarias–Odlyzko (computing by an analytic method), takes time to find a prime in . The Polymath4 project (2009–2010; Tao, Croot, Helfgott and other participants; arXiv:1009.3956, published in Math. Comp. 2012) aimed to beat the square-root barrier, and obtained partial results (for example computing the parity of the number of primes in an interval in about the same time) but did not break the barrier. Under the Riemann Hypothesis, prime gaps are at most , which gives the same exponent; Cramér's conjecture (gaps ) would give polynomial time but is unproven. A full derandomisation of (which follows from Impagliazzo–Wigderson-type circuit lower bounds) would give a polynomial-time algorithm.
Pseudodeterministic constructions. Chen, Lu, Oliveira, Ren and Santhanam (FOCS 2023; J. ACM 2026) gave an unconditional randomised polynomial-time algorithm that, for infinitely many , outputs a fixed canonical -bit prime with high probability, answering Gat and Goldwasser's question in the infinitely-often regime. Making it work for every , and removing the randomness, both remain open. Harvey (arXiv:2606.22851, June 2026, preprint) speeds up enumerating all primes up to , a different task.
Realistic applications
A deterministic polynomial-time prime constructor would give the first unconditional derandomisation of an important randomised search problem and remove a randomness requirement in cryptographic key generation (a theoretical point only; random primes are used in practice). Partial progress with would require new ideas in analytic number theory.
What counts as solved
Full resolution: a deterministic algorithm that on input outputs an -bit prime in time , with proof. Partial progress: any deterministic algorithm beating the square-root barrier, i.e. time for a fixed , or a pseudodeterministic polynomial-time construction that works for every .
How it gets verified
To verify: Expert reviewOnly expert review of the argument is possible today.
The claim is a deterministic polynomial-time algorithm that outputs an n-bit prime for every n, which needs a running-time proof. Mathlib has polynomial-time Turing machines (TM2ComputableInPolyTime) and Formal Conjectures defines IsPolyTime (Computability/Complexity.lean), so the statement could be written, but no Lean statement of it exists (Formal Conjectures pinned at commit e754a78 (17 October 2026)). Experts verify the proof; outputs for specific n are easy to check by primality testing but say nothing about the running time.
Claims
No claimed results on this problem.
Where the work is
Analytic number theory and complexity proof; computation can verify prime gaps but not the asymptotic claim.
Connected problems
- This problem is related to Polynomial-size explicit hitting sets for depth-3 (ΣΠΣ) arithmetic circuits over ℚBoth are instances of derandomising a dense-set search (the hitting-set paradigm), where a deterministic algorithm must find a witness a random one finds easily.
Progress
- May 24, 2023Pseudodeterministic polynomial-time primessource
Chen, Lu, Oliveira, Ren and Santhanam constructed canonical n-bit primes in randomised polynomial time for infinitely many n (FOCS 2023; J. ACM 2026).
- Sep 1, 2010Polymath4 papersource
The project reported partial results; the square-root barrier remained.
- Aug 9, 2009Polymath4 beginssource
A collaborative project started on finding primes deterministically in time below N^(1/2).
- Sep 1, 2004Deterministic primality testsource
Agrawal, Kayal and Saxena gave a deterministic polynomial-time primality test.