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.
The first line contains the number of test cases T. Each of the next T lines contains one integer n.
Output T lines, containing the corresponding lucky number for that test case.
1 <= T <= 20
1 <= n <= 1000
Sample Input: 2 1 2 Sample Output: 30 42
2664=2^3*3*111..so 2664 is not a lucky num.
how can be the answer be 2664
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?
@anirban ...for 1000 answer is 2664
for n = 1000 is the answer 3731?