powered by
This function uses the Sieve of Eratosthenes to find all the primes less than or equal to a given integer.
primesieve(sieved, unsieved)
Identified primes (empty vector for initialization)
Candidate integers
Returns a vector of primes sieved (selected) from the input vector.
The function assumes that unsieved is a vector of positive integers.
Jones, O.D., R. Maillardet, and A.P. Robinson. 2009. An Introduction to Scientific Programming and Simulation, Using R. Chapman And Hall/CRC.
prime
# NOT RUN { primesieve(c(), 2:200) # }
Run the code above in your browser using DataLab