Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

primes (version 1.1.0)

prime_count: Prime-counting Functions and Estimating the Value of the n-th Prime

Description

Functions for estimating π(n)---the number of primes less than or equal to n---and for estimating the value of pn, the n-th prime number.

Usage

prime_count(n, upper_bound)

nth_prime_estimate(n, upper_bound)

Arguments

n

an integer. See Details for more information.

upper_bound

a logical indicating whether to estimate the lower- or upper bound.

Author

Paul Egeler, MS

Details

The prime_count function estimates the number of primes n. When upper_bound = FALSE, it is guaranteed to under-estimate for all n17. 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 n6.

The methods of estimation used here are a few of many alternatives. For further information, the reader is directed to the References section.

References

"Prime-counting function" (2020) Wikipedia. https://en.wikipedia.org/wiki/Prime-counting_function#Inequalities (Accessed 26 Jul 2020).