fn eratosthenes(n: usize) -> Vec { let mut isprime = vec![true; n + 1]; isprime[0] = false; isprime[1] = false; for i in 2..=n { if !isprime[i] { continue; } for j in 2..=n / i { isprime[j * i] = false; } } isprime } fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let prime = eratosthenes(n); let mut ans = 0; for i in 0..prime.iter().count() { if prime[i] { ans += i; } } println!("{}", ans); }