powered by
Generate a sequence of prime numbers from min to max or generate a vector of the first n primes. Both functions use a fast implementation of the Sieve of Eratosthenes.
min
max
n
generate_n_primes(n)generate_primes(min = 2L, max)
generate_primes(min = 2L, max)
An integer vector of prime numbers.
the number of primes to generate.
the lower bound of the sequence.
the upper bound of the sequence.
Paul Egeler, MS
generate_primes(max = 12) ## [1] 2 3 5 7 11 generate_n_primes(5) ## [1] 2 3 5 7 11
Run the code above in your browser using DataLab