is_prime

Function is_prime 

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

Verifies if x is a prime number

Currently, this function is an abstraction over generating prime data up to sqrt(x) then calling the check prime method.

Therefore, if you need to check if lots of numbers are prime, it’s heavily encouraged to generate prime numbers then calling that method.

However, it is planned to make this function faster by using primality tests instead of generating data. See here.

§Examples

use prime_data::is_prime;
assert!( is_prime(65_537));
assert!(!is_prime(4_294_967_297));