[−][src]Function reikna::prime::next_prime
pub fn next_prime(n: u64) -> u64
Return the smallest prime number greater than n
.
This function works by adding 2
to n
, then testing
n
's primality with is_prime()
. If n
is initially
even, 1
is added to it. If the resulting value is not
prime, the normal sequence continues
Examples
use reikna::prime::next_prime; assert_eq!(next_prime(5), 7); assert_eq!(next_prime(95), 97);