const_primes

Function is_prime

Source
pub const fn is_prime(n: u64) -> bool
Expand description

Returns whether n is prime.

Does trial division with a small wheel up to log2(n) and then uses a deterministic Miller-Rabin primality test.

ยงExample

Basic usage:

const CHECK: bool = is_prime(18_446_744_073_709_551_557);
assert!(CHECK);