Skip to content

Commit

Permalink
remove unnecessary filter
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Jul 12, 2024
1 parent 5c4161e commit b6f1f1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/src/primes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ pub fn prime_factors(x: u64) -> PrimeFactors {

pub fn proper_divisors(x: u64) -> Vec<u64> {
let mut ret: Vec<u64> = vec![];
let factors: Vec<u64> = PrimeFactors::new(x).collect().filter_map(Option::as_ref);
let factors: Vec<u64> = PrimeFactors::new(x).collect();
ret.extend(factors.clone());
for i in 2..(factors.len()) {
for v in factors.iter().combinations(i) {
ret.push(v.iter().product());
ret.push(v.into_iter().product());
}
}
ret.sort();
Expand Down

0 comments on commit b6f1f1e

Please sign in to comment.