diff --git a/docs/src/rust/lib/primes.rst b/docs/src/rust/lib/primes.rst index ac691bce..2d85dcd2 100644 --- a/docs/src/rust/lib/primes.rst +++ b/docs/src/rust/lib/primes.rst @@ -58,10 +58,6 @@ Includes .. rust:fn:: pub fn primes::PrimeFactors::next() -> Option where I: Hash + Zero + One + Add + Ord + Copy + Div + Rem -.. rust:fn:: pub fn primes::proper_divisors(x: I) -> Vec 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(x: I) -> I where I: Hash + Zero + One + Add + Ord + Copy + Div + Rem Returns ``0`` if the number is prime, and the smallest prime factor otherwise. diff --git a/rust/src/include/primes.rs b/rust/src/include/primes.rs index a70d5882..e921dd82 100644 --- a/rust/src/include/primes.rs +++ b/rust/src/include/primes.rs @@ -130,22 +130,6 @@ pub fn prime_factors(x: I) -> PrimeFactors return PrimeFactors::new(x); } -pub fn proper_divisors(x: I) -> Vec -where I: Hash + Zero + One + Add + Ord + Copy + Div + Rem -{ - let mut ret: Vec = vec![]; - let factors: Vec = 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(x: I) -> I where I: Hash + Zero + One + Add + Ord + Copy + Div + Rem {