upper_bound

Function upper_bound 

Source
pub fn upper_bound(bound: u64) -> u64
Expand description

Estimates an upper bound for the amount of primes up to bound.

Sometimes, it’s too costly to evaluate the amount of primes from 1 to N, especially in situations where a “good enough” estimate would suffice.

This function is guaranteed to give you a value greater or equal to the actual amount of prime numbers up to the given number. The relative error is also guaranteed to be < 0.005, but it gets better as the given number goes to infinity.