fn get_factors(n: usize) -> Vec { let mut flgs = vec![true; n+1]; flgs[0] = false; flgs[1] = false; let mut factors = (0..=n).collect::>(); for i in 2..=(n as f64).sqrt().ceil() as usize { if !flgs[i] { continue; } for j in i..=n/i { flgs[i*j] = false; } let modval = i * i; for j in 1..=n/modval { let idx = modval*j; flgs[idx] = false; while factors[idx] % modval == 0 { factors[idx] /= modval; } } } factors } fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let factors = get_factors(n); let mut result = 0usize; for i in 1..=n { let right = factors[i]; result += ((n / right) as f64).sqrt().floor() as usize; } println!("{}", result); }