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
Sample Input: 2 1 2 Sample Output: 30 42
hide comments
nishaanth:
2012-02-04 07:20:09
answer for n = 1000 , 2988 ? |
|
Shizuo Heiwajima:
2012-01-29 11:15:07
Sure if upper bound of n is 1000? I got Runtime Error Last edit: 2012-01-29 11:16:00 |
|
tutum:
2012-01-08 16:24:05
2664 is not a lucky num |
|
tutum:
2012-01-08 16:22:07
2664=2^3*3*111..so 2664 is not a lucky num. |
|
nitin:
2011-12-27 19:49:45
how can be the answer be 2664
|
|
Aditya Muttur:
2011-12-27 16:38:52
how do i sort these numbers? i can create the lucky numbers, but is there any way of knowing which combination of 3 primes is larger than the other? |
|
Himanshu:
2011-12-21 09:38:29
@anirban ...for 1000 answer is 2664
|
|
Anirban Saha:
2011-12-21 04:09:54
for n = 1000 is the answer 3731?
|
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 |