English

A Note on Algorithms for Computing $p_n$

Number Theory 2025-10-21 v1 Data Structures and Algorithms

Abstract

We analyze algorithms for computing the nnth prime pnp_n and establish asymptotic bounds for several approaches. Using existing results on the complexity of evaluating the prime-counting function π(x)\pi(x), we show that the binary search approach computes pnp_n in O(n(logn)4)O(\sqrt{n} \, (\log n)^4) time. Assuming the Riemann Hypothesis and Cram\'er's conjecture, we construct a tighter interval around li1(n)^{-1}(n), leading to an improved sieve-based algorithm running in O(n(log7/2n)loglogn)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.

Keywords

Cite

@article{arxiv.2510.16285,
  title  = {A Note on Algorithms for Computing $p_n$},
  author = {Ansh Aggarwal},
  journal= {arXiv preprint arXiv:2510.16285},
  year   = {2025}
}

Comments

7 pages