Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
|||||||||||||
2022-07-05 05:40:46
solved Last edit: 2022-07-05 05:49:57 |
|||||||||||||
2022-02-10 19:13:56
Hint: prime factorization, and keep track of distinct prime number >=3 |
|||||||||||||
2021-07-30 01:33:46
Hint: Pre-Compute only upto 2700 numbers! |
|||||||||||||
2021-04-20 23:56:04
which is the third lucky number? 2*2*3*5 or 3*5*7? |
|||||||||||||
2020-10-18 17:06:36
**Take Care** - 'at least' |
|||||||||||||
2020-07-10 17:02:38
precompute and print. |
|||||||||||||
2020-04-20 18:45:41
If stuck, see <snip> [NG]: Nobody gets stuck on a problem this basic, but should that happen, seeing the ready solution doesn't do them any good. Last edit: 2021-04-21 13:39:09 |
|||||||||||||
2019-07-14 09:54:03
Brute force will work |
|||||||||||||
2019-07-05 19:29:12
"At leash" make me cry T_T |
|||||||||||||
2019-05-11 13:23:44
precompute and print. |