EPR  PrePrimes
A number is preprime if it has exactly 4 positive integer divisors. For example, 6 is preprime because its divisors are 1, 2, 3, and 6. The integers 6, 8, 10, 14 form the beginning of an infinite sequence of preprime numbers. Find the nth element of this sequence, where n is a 1based index.
Input
First line contains an integer T <= 20  the number of test cases. Following each line contains a single integer 1<= N <= 1000000.
Output
For each test case, print Nth preprime in a single line.
Example
Input:
4
2
4
24
43765
Output:
8
14
77
193539
hide comments
nadstratosfer:
20180525 11:58:16
Classicalgrade problem, if at the easier end of the NT category. Good constraints, several approaches possible, fun to optimize. Damn shame it's been rotting in tutorial for 7 years with less than a dozen solvers.. Admins, if possible please add #numbertheory tag. 

John and the cows:
20130817 15:47:37
yes, finally AC :) 
Added by:  Mahesh Chandra Sharma 
Date:  20110128 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 