AMR11E  Distinct Primes
Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is better than him at it. Prime numbers are of mystical importance in Arithmancy, and Lucky Numbers even more so. Lucky Numbers are those positive integers that have at least three distinct prime factors; 30 and 42 are the first two. Malfoy's teacher has given them a positive integer n, and has asked them to find the nth lucky number. Malfoy would like to beat Hermione at this exercise, so although he is an evil git, please help him, just this once. After all, the knowitall Hermione does need a lesson.
Input
The first line contains the number of test cases T. Each of the next T lines contains one integer n.
Output
Output T lines, containing the corresponding lucky number for that test case.
Constraints
1 <= T <= 20
1 <= n <= 1000
Example
Sample Input: 2 1 2 Sample Output: 30 42
hide comments
Rezaul H Sagar:
20160730 08:46:43
map<int,int> gives me 2988 is the 1000th lucky number :/ 

ab_bh:
20160609 23:17:05
how are you all doing it....my 568th lucky number is 2664


mkfeuhrer:
20160603 13:14:17
use sieve().... AC :) 

mohitgupta07:
20160510 21:08:52
sieve...:P :P ac in one go :) :) 

hollapr:
20160509 19:24:03
hint is 2*3*5 is 30 and 2*3*2*5 =60 is also lucky number.


hollapr:
20160509 19:19:09
Weird... I thought, this is the answer... But, it seems to be different... https://oeis.org/A007304/b007304.txt 

hareesh:
20160408 12:50:03
Brute force C> AC in 0.00s :D


lt:
20160326 14:43:44
brute force > C++ > AC in 0.00s :P 

try2catch:
20160323 19:07:01
Today my 100th.


rahul_verma:
20160207 20:30:25
yes !!! done it 
Added by:  Varun Jalan 
Date:  20111215 
Time limit:  3s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Varun Jalan  ICPC Asia regionals, Amritapuri 2011 