Skip to content
DAH

Deterministic construction of an n-bit prime in time polynomial in n (current best 2n/2+o(n))

OpenTo verify: Expert reviewPosed by Folklore in derandomisation; Polymath4 project (2009–10); Odlyzko and Lagarias–Odlyzko (1987)
AI-reviewed
On this page16 sections
Difficulty
76/100Major open
How far from a resolution. P vs NP = 100
Application value
6/100Theoretical
Realistic practical impact if resolved. P vs NP = 100
Leverage
30/100Local
How much other knowledge hinges on it. P vs NP = 100

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?

  1. 1Random guess then test finds primes fast
  2. 2Can we avoid randomness entirely?
  3. 3Best proven recipe takes about √N time
  4. 4Polymath4 tried and fell short
  5. 5Open: fast fixed recipe for primes

The problem. Given N=2nN=2^n, output a prime in [N,2N][N,2N] 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 NN is about 1/ln⁡N1/\ln N, so the expected running time is poly(n)\mathrm{poly}(n). Is there a deterministic algorithm running in time poly(n)\mathrm{poly}(n), i.e. (log⁡N)O(1)(\log N)^{O(1)}?

The best unconditional algorithm takes N1/2+o(1)N^{1/2+o(1)} time, exponential in nn. 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 N1+o(1)N^{1+o(1)} time.
  • Odlyzko and Lagarias–Odlyzko (analytic methods for computing the prime counting function π(x)\pi(x)) find a prime in [N,2N][N,2N] in N1/2+o(1)N^{1/2+o(1)} 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 Nlog⁡N\sqrt N\log N, which gives the same exponent. Cramér's conjecture (gaps of size about log⁡2N\log^2 N) 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 nn, outputs one fixed prime with high probability (a "pseudodeterministic" construction). Making it work for every nn, 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 N=2nN=2^n, output a prime in [N,2N][N,2N] 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 poly(n)\mathrm{poly}(n) because primes have density ∼1/ln⁡N\sim 1/\ln N. Is there a deterministic algorithm running in time poly(n)\mathrm{poly}(n), i.e. (log⁡N)O(1)(\log N)^{O(1)}? The best unconditional algorithm takes N1/2+o(1)N^{1/2+o(1)} time, exponential in nn. 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)
Words on this page
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)
New to this? Read first

Path to understanding

foundations → problem

The research entries this problem rests on, in the order to read them. Each links to its explainer.

  1. Start with
  2. Step 2
  3. 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 N1+o(1)N^{1+o(1)}. The unconditional state of the art, due to Odlyzko and Lagarias–Odlyzko (computing π(x)\pi(x) by an analytic method), takes N1/2+o(1)N^{1/2+o(1)} time to find a prime in [N,2N][N,2N]. 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 O(Nlog⁡N)O(\sqrt N\log N), which gives the same exponent; Cramér's conjecture (gaps O(log⁡2N)O(\log^2N)) would give polynomial time but is unproven. A full derandomisation of BPP\mathsf{BPP} (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 nn, outputs a fixed canonical nn-bit prime with high probability, answering Gat and Goldwasser's question in the infinitely-often regime. Making it work for every nn, and removing the randomness, both remain open. Harvey (arXiv:2606.22851, June 2026, preprint) speeds up enumerating all primes up to NN, 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 N1/2−δN^{1/2-\delta} would require new ideas in analytic number theory.

What counts as solved

Full resolution: a deterministic algorithm that on input nn outputs an nn-bit prime in time poly(n)\mathrm{poly}(n), with proof. Partial progress: any deterministic algorithm beating the square-root barrier, i.e. time 2(1/2−δ)n2^{(1/2-\delta)n} for a fixed δ>0\delta>0, or a pseudodeterministic polynomial-time construction that works for every nn.

How it gets verified

To verify: Expert review

Only 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

Theory
95%
New mathematical or conceptual ideas
Engineering
0%
Building instruments, chips, systems, software, formal proofs
Compute
5%
Raw computation, search, simulation
Empirical
0%
Observation, experiment, data collection

Analytic number theory and complexity proof; computation can verify prime gaps but not the asymptotic claim.

Connected problems

Progress

  1. May 24, 2023
    Pseudodeterministic polynomial-time primes

    Chen, Lu, Oliveira, Ren and Santhanam constructed canonical n-bit primes in randomised polynomial time for infinitely many n (FOCS 2023; J. ACM 2026).

    source
  2. Sep 1, 2010
    Polymath4 paper

    The project reported partial results; the square-root barrier remained.

    source
  3. Aug 9, 2009
    Polymath4 begins

    A collaborative project started on finding primes deterministically in time below N^(1/2).

    source
  4. Sep 1, 2004
    Deterministic primality test

    Agrawal, Kayal and Saxena gave a deterministic polynomial-time primality test.

    source