nthPrimeUpperBound

Calculates the upper bound of the integer range containing the nth prime.

Useful for knowing how large of a sieve to prepare if you want to collect a certain number of prime numbers, for example.

@nogc @safe pure nothrow
size_t
nthPrimeUpperBound
(
size_t n
)

Examples

assert(nthPrimeUpperBound(4) == 11);
assert(nthPrimeUpperBound(7) == 18);
assert(nthPrimeUpperBound(50) == 263);

Meta