Functions for estimating \(\pi(n)\)---the number of primes less than or equal to \(n\)---and for estimating the value of \(p_n\), the n-th prime number.
prime_count(n, upper_bound)nth_prime_estimate(n, upper_bound)
an integer. See Details for more information.
a logical indicating whether to estimate the lower- or upper bound.
Paul Egeler, MS
The prime_count
function estimates the number of primes \(\le n\).
When upper_bound = FALSE
, it is guaranteed to under-estimate for all
\(n \ge 17\).
When upper_bound = TRUE
, it holds for all positive \(n\).
The nth_prime_estimate
function brackets upper and lower bound values of
the nth prime. It is valid for \(n \ge 6\).
The methods of estimation used here are a few of many alternatives. For further information, the reader is directed to the References section.
"Prime-counting function" (2020) Wikipedia. https://en.wikipedia.org/wiki/Prime-counting_function#Inequalities (Accessed 26 Jul 2020).