You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
370 B

fn div_num(n: u32) -> u32 {
let mut res = 0;
for i in 1..=n {
if n % i == 0 { res += 1; }
}
return res;
}
fn main() {
let mut n = 1;
let mut best_dn = 1;
for k in 2..50000 {
n += k;
let dn = div_num(n);
if dn > best_dn {
best_dn = dn;
println!("[{}]{}:{}",k, n, dn);
}
}
}