Function utils::number::is_prime

source ·
pub fn is_prime<T: UnsignedInteger>(n: T) -> bool
Expand description

Checks if the provided unsigned integer n is a prime number.

§Examples

assert_eq!(is_prime(7901u32), true);
assert_eq!(is_prime(2147483647u32), true);
assert_eq!(is_prime(4294967291u32), true);
assert_eq!(is_prime(6u32), false);
assert_eq!(is_prime(123u32), false);