fn get_upper_primes() -> Vec { let mut flgs: Vec = vec![true; 1_000_001]; flgs[0] = false; flgs[1] = false; let mut result: Vec = vec![]; for i in 2..=1_000_000 { if !flgs[i] { continue; } if i > 100_000 { result.push(i); if result.len() == 9 { break; } } for j in i..=1_000_000/i { flgs[j*i] = false; } } result } fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut result: Vec = vec![]; result.push(1); let cand_bases = get_upper_primes(); let mut cands: Vec = vec![]; for a in cand_bases.iter() { for b in cand_bases.iter() { let val = a * b; if !cands.contains(&val) { cands.push(val); } } } cands.sort(); for i in 0..9 { result.push(cands[i]); } println!("{}", result[n-1]); }