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

View source: R/RcppExports.R

prime_countR Documentation

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

Description

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.

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.

Details

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.

Author(s)

Paul Egeler, MS

References

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


Ironholds/primes documentation built on Feb. 1, 2024, 1:26 a.m.