Skip to content

Commit

Permalink
add placeholder docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 23, 2024
1 parent e0473bd commit e30bb0c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
4 changes: 0 additions & 4 deletions docs/src/rust/lib/primes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ Includes
.. rust:fn:: pub fn primes::PrimeFactors::next() -> Option<I> where I: Hash + Zero + One + Add + Ord + Copy + Div<Output=I> + Rem<Output=I>
.. rust:fn:: pub fn primes::proper_divisors<I>(x: I) -> Vec<I> where I: NumAssign + Bounded + Ord + Eq + Hash + Copy
This function returns a vector of the proper divisors of a number.

.. rust:fn:: pub fn is_composite<I>(x: I) -> I where I: Hash + Zero + One + Add + Ord + Copy + Div<Output=I> + Rem<Output=I>
Returns ``0`` if the number is prime, and the smallest prime factor otherwise.
Expand Down
16 changes: 0 additions & 16 deletions rust/src/include/primes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,6 @@ pub fn prime_factors<I>(x: I) -> PrimeFactors<I>
return PrimeFactors::new(x);
}

pub fn proper_divisors<I>(x: I) -> Vec<I>
where I: Hash + Zero + One + Add + Ord + Copy + Div<Output=I> + Rem<Output=I>
{
let mut ret: Vec<I> = vec![];
let factors: Vec<I> = PrimeFactors::new(x).collect();
ret.extend(factors.clone());
for i in 2..(factors.len()) {
for v in factors.iter().combinations(i) {
ret.push(v.into_iter().fold(one(), |x, y| x * (*y)));
}
}
ret.sort();
ret.dedup();
return ret;
}

pub fn is_composite<I>(x: I) -> I
where I: Hash + Zero + One + Add + Ord + Copy + Div<Output=I> + Rem<Output=I>
{
Expand Down

0 comments on commit e30bb0c

Please sign in to comment.