Struct num_primes::Verification [−][src]
pub struct Verification;
Expand description
Prime Verification
This struct is used to verify whether integers are prime, safe prime, or composite.
use num_primes::{Generator,Verification};
fn main(){
let prime = Generator::new_prime(1024);
let safe = Generator::safe_prime(128);
let is_prime: bool = Verification::is_prime(&prime);
let is_safe_prime: bool = Verification::is_safe_prime(&safe);
assert_eq!(is_prime, true);
assert_eq!(is_safe_prime, true);
}
Implementations
Very Smooth Number
This Function Is Deprecated And Should Rarely Be Used
use num_traits::FromPrimitive;
use num_bigint::BigUint;
use num_primes::Verification;
fn main(){
// Set BigUint To 7
let x: BigUint = BigUint::from_u64(7u64).unwrap();
// Verify Its A Smooth Number
let result: bool = Verification::is_smooth_number(&x,31.0,5);
println!("Is A {} Smooth Number: {}",x,result);
}