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.
35 lines
747 B
35 lines
747 B
2 years ago
|
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();
|
||
|
return lines.map(|line| line.unwrap().parse::<u32>().unwrap())
|
||
|
.collect();
|
||
|
}
|
||
|
|
||
|
fn divs_num_test(n: u32) -> u32 {
|
||
|
let mut res = 0;
|
||
|
for i in 1..n {
|
||
|
if n % i == 0 { res += 1; }
|
||
|
}
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
let ps = get_ps();
|
||
|
let mut n = 1;
|
||
|
let mut best_dn = 1;
|
||
|
for k in 2..50000 {
|
||
|
n += k;
|
||
|
let dn = 500; //500; //divs_num(n);
|
||
|
//if dn > best_dn {
|
||
|
// best_dn = dn;
|
||
|
//println!("[{}]{}:{}",k, n, dn);
|
||
|
//}
|
||
|
}
|
||
|
}
|