const LIMIT: usize = 31; fn solve(primes: &Vec>) -> usize { let mut x = String::new(); std::io::stdin().read_line(&mut x).ok(); let x: usize = x.trim().parse().unwrap(); for i in 2..=LIMIT { let mut target = x; let mut xside = 1usize; let mut pside = 1usize; for j in 2..=i { let mut xcnt = 0usize; while target % j == 0 { target /= j; xcnt += 1; } xside *= 1 + xcnt; pside *= 1 + xcnt + primes[i][j]; } if xside * 2 == pside { return x * i; } } 0 } fn main() { let mut t = String::new(); std::io::stdin().read_line(&mut t).ok(); let t: usize = t.trim().parse().unwrap(); let mut result = Vec::with_capacity(t); let mut primes = vec![vec![0usize; LIMIT+1]; LIMIT+1]; for i in 2..=LIMIT { let mut target = i; for j in 2..=i { while target % j == 0 { target /= j; primes[i][j] += 1; } } } for _ in 0..t { result.push(solve(&primes)); } for &v in result.iter() { println!("{}", v); } }