[][src]Function reikna::prime::eratosthenes

pub fn eratosthenes(max_u64: u64) -> Vec<u64>

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

This function is probably not very useful to most users, and is used primarily in validating the other prime sieves.

Panics

Panics if max_u64 cannot be cast into a usize.

Can panic if max_u64 is so large that not enough memory can be allocated for the sieve.

Examples

use reikna::prime::eratosthenes;
assert_eq!(eratosthenes(20), vec![2, 3, 5, 7, 11, 13, 17, 19]);