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
ram_mahto:
2016-09-06 15:57:47
how to see editorial in spoj for all problems |
|
Anuj Arora:
2016-09-05 09:00:03
AC in one go!!! |
|
suraj_:
2016-08-29 09:01:35
yeaaah!! AC in one go. sieve + brute force= answer
|
|
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 :-) |
|
mohitgupta07:
2016-05-10 21:08:52
sieve...:P :P ac in one go :) :) |
|
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
|
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 |