const_primes

Function primes

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

Returns the N first prime numbers.

Primes might be relevant for you if you intend to later use these prime numbers for related computations.

Uses a segmented sieve of Eratosthenes.

ยงExample

const PRIMES: [u32; 10] = primes();
assert_eq!(PRIMES, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]);