primesieve: Function to identify all the primes in a vector of positive...

Description Usage Arguments Details Value References See Also Examples

View source: R/primesieve.R

Description

This function uses the Sieve of Eratosthenes to find all the primes less than or equal to a given integer.

Usage

1
primesieve(sieved, unsieved)

Arguments

sieved

Identified primes (empty vector for initialization)

unsieved

Candidate integers

Details

The function assumes that unsieved is a vector of positive integers.

Value

Returns a vector of primes sieved (selected) from the input vector.

References

Jones, O.D., R. Maillardet, and A.P. Robinson. 2009. An Introduction to Scientific Programming and Simulation, Using R. Chapman And Hall/CRC.

See Also

prime

Examples

1
primesieve(c(), 2:200)

spuRs documentation built on May 20, 2017, 2:33 a.m.

Search within the spuRs package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.