[][src]Function reikna::prime::segmented_eratosthenes

pub fn segmented_eratosthenes(max: u64) -> Vec<u64>

Return a Vec<u64> of the primes in [1, max] using a segmented Sieve of Eratosthenes.

This function is best suited for sieving with a large max, otherwise atkin() is preferable. prime_sieve() can be used to chose between the two automatically.

The size of the segments is determined by S_SIEVE_SIZE.

Panics

Panics if max cannot be cast into a usize.

Examples

use reikna::prime::segmented_eratosthenes;
assert_eq!(segmented_eratosthenes(10), vec![2, 3, 5, 7]);