Skip to contents

This function will use the primes package unless it either is missing, or if options("zulutils.zerodeps") has been explicitly set to false, in which case it will use a local implementation of the sieve of Erastosthenes.

Usage

nth_prime(n)

Arguments

n

the position of the prime number to be calculated

Value

the nth prime number

Examples

nth_prime(1) # 2
#> [1] 2
nth_prime(10) # 29
#> Loading required namespace: primes
#> [1] 29
nth_prime(100) # 541
#> [1] 541
nth_prime(1000) # 7919
#> [1] 7919
nth_prime(10000) # 104729
#> [1] 104729