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 $\pi(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\'er'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.
翻译:暂无翻译