fn get_primes(n: usize) -> Vec { let mut flgs: Vec = vec![true; n+1]; flgs[0] = false; flgs[1] = false; for i in 0..=((n as f64 + 1.0).sqrt().floor() as usize) { if !flgs[i] { continue; } for j in i..=n/i { flgs[j*i] = false; } } flgs } fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); println!("{}", get_primes(n).iter().enumerate().filter(|pair| *pair.1).map(|pair| pair.0).sum::()); }