Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
hxzhao527 committed Dec 3, 2023
1 parent b5bdde2 commit bdb925c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,20 @@ macro_rules! vec2 {
temp_vec
}
};
}

fn divisors(integer: u32) -> Result<Vec<u32>, String> {
// assert!((u32::MAX as f64) < f64::MAX );
let mut div = vec![];
for i in 2..(integer as f64).sqrt() as u32 + 1{
if integer%i == 0{
div.push(i);
div.push(integer/i);
}

Check warning on line 64 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L57-L64

Added lines #L57 - L64 were not covered by tests
}
if div.is_empty(){
return Err(format!("{} is prime", integer));
}
div.sort_unstable();
Ok(div)

Check warning on line 70 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L66-L70

Added lines #L66 - L70 were not covered by tests
}

0 comments on commit bdb925c

Please sign in to comment.