pub struct Prime {}Expand description
A struct that provides methods for prime factorization using pollard rho algorithm and testing primality of numbers.
Implementations§
Source§impl Prime
impl Prime
Sourcepub fn pollard(n: u64) -> u64
pub fn pollard(n: u64) -> u64
Pollard’s rho algorithm for integer factorization.
§Arguments
n- The number to factorize.
§Returns
A non-trivial factor of n.
§Time Complexity
The algorithm offers a trade-off between its running time and the probability that it finds a factor.
A prime divisor can be achieved with a probability around 0.5, in O(?d) <= O(n^(1/4)) iterations.
This is a heuristic claim, and rigorous analysis of the algorithm remains open.
Auto Trait Implementations§
impl Freeze for Prime
impl RefUnwindSafe for Prime
impl Send for Prime
impl Sync for Prime
impl Unpin for Prime
impl UnwindSafe for Prime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more