Function primal_estimate::nth_prime

source ·
pub fn nth_prime(n: u64) -> (u64, u64)
Expand description

Gives estimated bounds for pn, the nth prime number, 1-indexed (i.e. p1 = 2, p2 = 3).

That is, if (a,b) = estimate_nth_prime(n), apnb. The bounds used are proved in [1], [2, Théorèmes 1.6–1.8] (both summarised in [2, pp. 14–15]) and [3, Section 6.1.2].

[1]: Massias, Jean-Pierre; Robin, Guy. “Bornes effectives pour certaines fonctions concernant les nombres premiers.” Journal de théorie des nombres de Bordeaux 8.1 (1996): 215-242.

[2]: Dusart, Pierre. “Autour de la fonction qui compte le nombre de nombres premiers.” PhD diss., Université de Limoges, 1998.

[3]: Dusart, Pierre. “Estimates of Some Functions Over Primes without R.H.” ArXiv:1002.0442. 2010.

§Examples

// the 1e9-th prime
let billionth = 22_801_763_489;

let (low, high) = primal::estimate_nth_prime(1_000_000_000);
// check the bounds are satisfied
assert!(low <= billionth && billionth <= high);