const_primes

Function sieve

Source
pub const fn sieve<const N: usize>() -> [bool; N]
Expand description

Returns an array of size N where the value at a given index indicates whether the index is prime.

ยงExample

const PRIMALITY: [bool; 10] = sieve();
//                     0      1      2     3     4      5     6      7     8      9
assert_eq!(PRIMALITY, [false, false, true, true, false, true, false, true, false, false]);