|
|
|
@ -2,8 +2,6 @@ use std::fs::File;
|
|
|
|
|
use std::io::{ self, BufRead, BufReader }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PS_SIZE: usize = 500usize; |
|
|
|
|
|
|
|
|
|
fn get_ps() -> Vec<u32> { |
|
|
|
|
let file = File::open("primes.txt").unwrap(); |
|
|
|
|
let lines = io::BufReader::new(file).lines(); |
|
|
|
@ -11,11 +9,23 @@ fn get_ps() -> Vec<u32> {
|
|
|
|
|
.collect(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn divs_num_test(n: u32) -> u32 { |
|
|
|
|
fn div_num(ps: &Vec<u32>, n: u32) -> u32 { |
|
|
|
|
fn max_div(m: u32, k: u32) -> u32 { |
|
|
|
|
let mut res = 0; |
|
|
|
|
for i in 1..n { |
|
|
|
|
if n % i == 0 { res += 1; } |
|
|
|
|
let mut mm = m; |
|
|
|
|
while mm % k == 0 { |
|
|
|
|
mm /= k; |
|
|
|
|
res += 1; |
|
|
|
|
} |
|
|
|
|
res |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let mut res = 1; |
|
|
|
|
for p in ps { |
|
|
|
|
let md = max_div(n, *p) + 1; |
|
|
|
|
res *= md; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -23,12 +33,12 @@ fn main() {
|
|
|
|
|
let ps = get_ps(); |
|
|
|
|
let mut n = 1; |
|
|
|
|
let mut best_dn = 1; |
|
|
|
|
for k in 2..50000 { |
|
|
|
|
for k in 2..80000 { |
|
|
|
|
n += k; |
|
|
|
|
let dn = 500; //500; //divs_num(n);
|
|
|
|
|
//if dn > best_dn {
|
|
|
|
|
// best_dn = dn;
|
|
|
|
|
//println!("[{}]{}:{}",k, n, dn);
|
|
|
|
|
//}
|
|
|
|
|
let dn = div_num(&ps, n); |
|
|
|
|
if dn > best_dn { |
|
|
|
|
best_dn = dn; |
|
|
|
|
println!("[{}]{}:{}", k, n, dn); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|