Crate prime_suspects [] [src]

Functions that sieve primes from the integers up to an input maximum.

Functions

eratosthenes_sieve

An implementation of the sieve of Eratosthenes, as described in the Wikipedia article.

segmented_sieve

A segmented approach to sieveing, keeping memory use to O(√n). As Sorensen states, this is the most practical optimization to the sieve of Eratosthenes.

segmented_sieve_parallel

Same algorithm as the regular segmented_sieve function, but each larger segment to be sieved is computed in parallel threads.