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 n-th 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 know-it-all 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
Input: 2 1 2 Output: 30 42
hide comments
|
rishabh_1997:
2016-09-19 06:48:55
Nice question... Sieve & Some smart work. |
|
itsnaveen01:
2016-09-18 13:35:42
Sieve And Hashing !! |
|
ram_mahto:
2016-09-06 15:57:47
how to see editorial in spoj for all problems |
|
Rezaul H Sagar:
2016-07-30 08:46:43
map<int,int> gives me 2988 is the 1000th lucky number :/ |
|
ab_bh:
2016-06-09 23:17:05
how are you all doing it....my 568th lucky number is 2664
|
|
mkfeuhrer:
2016-06-03 13:14:17
use sieve().... AC :-) |
|
hollapr:
2016-05-09 19:24:03
hint is 2*3*5 is 30 and 2*3*2*5 =60 is also lucky number.
|
|
hollapr:
2016-05-09 19:19:09
Weird... I thought, this is the answer... But, it seems to be different... https://oeis.org/A007304/b007304.txt |
|
hareesh:
2016-04-08 12:50:03
Brute force C-> AC in 0.00s :D
|
|
lt:
2016-03-26 14:43:44
brute force -> C++ -> AC in 0.00s :P |
Added by: | Varun Jalan |
Date: | 2011-12-15 |
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 |