Table of Contents
Fetching ...

A Note on Algorithms for Computing $p_n$

Ansh Aggarwal

TL;DR

This paper analyzes several algorithmic strategies for computing the $n$-th prime $p_n$, contrasting a binary-search approach that leverages the prime-counting function $\pi(x)$ with sieve-based methods. Unconditionally, combining bounds for $p_n$ with the best known $\pi(x)$-evaluation yields a bound of $O(\sqrt{n}\,\log^4 n)$ for computing $p_n$. Sublinear and segmented sieves, given current knowledge of $p_n$ bounds, do not beat binary search asymptotically. Conditional on the Riemann Hypothesis and Cramér's conjecture, the authors construct a tighter interval around $\alpha$ with $\mathrm{li}(\alpha)=n$, enabling a sieve-based method that runs in $O(\sqrt{n}\,\log^{7/2} n\,\log\log n)$ time, which would surpass binary search under these assumptions. The results indicate that future improvements to prime-gap estimates could lead to provably faster, prime-finding algorithms.

Abstract

We analyze algorithms for computing the $n$th prime $p_n$ and establish asymptotic bounds for several approaches. Using existing results on the complexity of evaluating the prime-counting function $π(x)$, we show that the binary search approach computes $p_n$ in $O(\sqrt{n} \, (\log n)^4)$ time. Assuming the Riemann Hypothesis and Cramér's conjecture, we construct a tighter interval around li$^{-1}(n)$, leading to an improved sieve-based algorithm running in $O(\sqrt{n} \, (\log ^{7/2} n) \, \log \log n)$ time. This improvement, though conditional, suggests that further refinements to prime gap estimates may yield provably faster methods for computing primes.

A Note on Algorithms for Computing $p_n$

TL;DR

This paper analyzes several algorithmic strategies for computing the -th prime , contrasting a binary-search approach that leverages the prime-counting function with sieve-based methods. Unconditionally, combining bounds for with the best known -evaluation yields a bound of for computing . Sublinear and segmented sieves, given current knowledge of bounds, do not beat binary search asymptotically. Conditional on the Riemann Hypothesis and Cramér's conjecture, the authors construct a tighter interval around with , enabling a sieve-based method that runs in time, which would surpass binary search under these assumptions. The results indicate that future improvements to prime-gap estimates could lead to provably faster, prime-finding algorithms.

Abstract

We analyze algorithms for computing the th prime and establish asymptotic bounds for several approaches. Using existing results on the complexity of evaluating the prime-counting function , we show that the binary search approach computes in time. Assuming the Riemann Hypothesis and Cramér's conjecture, we construct a tighter interval around li, leading to an improved sieve-based algorithm running in time. This improvement, though conditional, suggests that further refinements to prime gap estimates may yield provably faster methods for computing primes.
Paper Structure (8 sections, 9 theorems, 21 equations)

This paper contains 8 sections, 9 theorems, 21 equations.

Key Result

Corollary 2.1

$R - L = n(\log n + \log (\log n)) - n (\log n+ \log (\log n) - 1) = n$

Theorems & Definitions (16)

  • Corollary 2.1
  • Lemma 2.2
  • proof
  • Theorem 3.1
  • proof
  • Lemma 3.2
  • proof
  • Lemma 4.1
  • proof
  • Theorem 4.2
  • ...and 6 more