Struct slow_primes::StreamingSieve [] [src]

pub struct StreamingSieve { /* fields omitted */ }

A segmented sieve that yields only a small run of primes at a time.

This is heavily inspired by this segmented sieve code.

Methods

impl StreamingSieve
[src]

Create a new instance of the streaming sieve that will correctly progressively filter primes up to limit.

Extract the next chunk of filtered primes, the return value is Some((low, v)) or None if the sieve has reached the limit.

The vector stores bits for each odd number starting at low. Bit n of v is set if and only if low + 2 * n + 1 is prime.

NB. the prime 2 is not included in any of these sieves and so needs special handling.

Trait Implementations

impl Debug for StreamingSieve
[src]

Formats the value using the given formatter.