[−][src]Function reikna::prime::is_prime
pub fn is_prime(value: u64) -> bool
Return true
if value
is prime, and false if it is composite.
This function works by checking if value
is a small prime,
the checking if it is divisible by two or three.
Next, a loop is preformed to check if value
can be represented
in the form 6x +/- 1
, if it can, value
is composite. Otherwise
it is prime.
Examples
use reikna::prime::is_prime; assert_eq!(is_prime(64), false); assert_eq!(is_prime(97), true); assert_eq!(is_prime(113), true); assert_eq!(is_prime(128), false);