use std::io::*; use std::str::FromStr; use std::collections::HashSet; fn main() { exec(read()); } fn exec(i: usize) { let a = get_prime_list(); println!("{}", get(a)[i - 1]); } fn get_prime_list() -> Vec { let acc: Vec = vec![]; let start: i64 = 100001; rec_prime(start, acc) } fn rec_prime(mut current: i64, mut acc: Vec) -> Vec { if acc.len() >= 5 { return acc; } else { if is_prime(current) { acc.push(current); } current = current + 1; rec_prime(current, acc) } } fn is_prime(current: i64) -> bool { let target = (current as f64).sqrt() as i64 + 1; let mut i: i64 = 2; while i <= target { if current % i == 0 { return false; } i += 1; } true } fn get(l: Vec) -> Vec { let mut a: Vec = vec![]; a.push(1); for i in &l { for j in &l { if i != j { a.push((i * j) as i64); } } } let v: HashSet = a.iter().cloned().collect(); let mut r: Vec = v.into_iter().collect(); r.sort(); r } fn read() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") }