generate_n_primes {primes} | R Documentation |
Generate a Sequence of Prime Numbers
Description
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.
Usage
generate_n_primes(n)
generate_primes(min = 2L, max)
Arguments
n |
the number of primes to generate. |
min |
the lower bound of the sequence. |
max |
the upper bound of the sequence. |
Value
An integer vector of prime numbers.
Author(s)
Paul Egeler, MS
Examples
generate_primes(max = 12)
## [1] 2 3 5 7 11
generate_n_primes(5)
## [1] 2 3 5 7 11
[Package primes version 1.6.0 Index]