[−][src]Struct num_primes::Factorization
Prime Factorization
This struct is used to factor large numbers and return their largest prime factor
use num_primes::{Generator,Factorization}; fn main() { // Generates New Unsighed Integer of 64 bits let uint = Generator::new_uint(64); // Prime Factorization let prime_factor = Factorization::prime_factor(uint); match prime_factor { Some(x) => println!("Largest Prime Factor: {}",x), None => println!("No Prime Factors Found"), } }
Implementations
impl Factorization[src]
pub fn prime_factor(mut n: BigUint) -> Option<BigUint>[src]
Prime Factorization
This is a method of factoring the largest prime factors of large numbers. It is slow and should not be relied on. It can easily factor 32-bit numbers and sometimes 64-bit.
It returns as a Option<BigUint> type
use num_primes::{Generator,Factorization}; fn main() { // Generates New Unsighed Integer of 32 bits let uint = Generator::new_uint(32); // Prime Factorization let factor = Factorization::prime_factor(uint); match factor { Some(factor) => println!("Largest Prime Factor: {}",factor), None => println!("No Prime Factors Found"), } }
Auto Trait Implementations
impl RefUnwindSafe for Factorization[src]
impl Send for Factorization[src]
impl Sync for Factorization[src]
impl Unpin for Factorization[src]
impl UnwindSafe for Factorization[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,