Struct primes::TrialDivision
source · pub struct TrialDivision { /* private fields */ }
Expand description
A prime generator, using the Trial Division method.
Create with let mut pset = TrialDivision::new()
, and then use pset.iter()
to iterate over all
primes.
Implementations§
source§impl TrialDivision
impl TrialDivision
sourcepub fn new() -> TrialDivision
pub fn new() -> TrialDivision
A new prime generator, primed with 2 and 3
Trait Implementations§
source§impl Clone for TrialDivision
impl Clone for TrialDivision
source§fn clone(&self) -> TrialDivision
fn clone(&self) -> TrialDivision
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for TrialDivision
impl Default for TrialDivision
source§impl Index<usize> for TrialDivision
impl Index<usize> for TrialDivision
Auto Trait Implementations§
impl Freeze for TrialDivision
impl RefUnwindSafe for TrialDivision
impl Send for TrialDivision
impl Sync for TrialDivision
impl Unpin for TrialDivision
impl UnwindSafe for TrialDivision
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
source§impl<P> PrimeSet for Pwhere
P: PrimeSetBasics,
impl<P> PrimeSet for Pwhere
P: PrimeSetBasics,
fn is_empty(&self) -> bool
source§fn generator(&mut self) -> PrimeSetIter<'_, Self> ⓘ
fn generator(&mut self) -> PrimeSetIter<'_, Self> ⓘ
Iterator over all primes not yet found
source§fn iter(&mut self) -> PrimeSetIter<'_, Self> ⓘ
fn iter(&mut self) -> PrimeSetIter<'_, Self> ⓘ
Iterator over all primes, starting with 2. If you don’t care about the “state” of the
PrimeSet
, this is what you want!source§fn find(&mut self, n: u64) -> (usize, u64)
fn find(&mut self, n: u64) -> (usize, u64)
Find the next largest prime from a number Read more