generate_primes: Generate a Sequence of Prime Numbers

View source: R/sieve.R

generate_n_primesR 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

Ironholds/primes documentation built on Feb. 1, 2024, 1:26 a.m.