find all divisors

This commit is contained in:
Rachel Lambda Samuelsson 2024-10-13 22:44:50 +02:00
parent 44ec170681
commit efbb2a1220

View File

@ -5,17 +5,17 @@ fn sqrtu64(x: u64) -> u64 {
}
fn main() {
println!("Enter a number");
let mut input_line = String::new();
io::stdin()
.read_line(&mut input_line)
.expect("Failed to read line");
let x: u64 = input_line.trim().parse().expect("Input not an integer");
let sqrtx = sqrtu64(x);
let mut primes = vec![2,3,5,7];
let mut i: u64 = 12;
while i <= sqrtx {
while i < x {
let n = i-1;
let m = i+1;
let sqrtm = sqrtu64(m);