Trait curv::arithmetic::traits::Primes
source · pub trait Primes {
fn next_prime(&self) -> Self;
fn is_probable_prime(&self, n: u32) -> bool;
}
Expand description
Utilities for searching / testing prime numbers
Required Methods§
sourcefn next_prime(&self) -> Self
fn next_prime(&self) -> Self
Finds next prime number using probabilistic algorithms
sourcefn is_probable_prime(&self, n: u32) -> bool
fn is_probable_prime(&self, n: u32) -> bool
Probabilistically determine whether number is prime
If number is prime, is_probable_prime
always returns true. If number is composite,
is_probable_prime
probably return false. The probability of returning true for a randomly
chosen non-prime is at most 4^(-reps).