TDKPRIME  Finding the Kth Prime
The problem statement is really simple. There are some queries. You are to give the answers.
Input
An integer stating the number of queries Q(equal to 50000), and Q lines follow, each containing one integer K between 1 and 5000000 inclusive.
Output
Q lines with the answer of each query: the Kth prime number.
Example
Input: 7 1 10 100 1000 10000 100000 1000000 Output: 2 29 541 7919 104729 1299709 15485863
hide comments
himanshu_159:
20180114 07:29:58
@ayushgupta1997 how you got the max value


ayushgupta1997:
20171209 11:53:04
Simple Problem ,attempted after 1 year AC in one go :)


Sushant Moon:
20171006 00:01:57
Is there some problem with the test cases, i checked/compared/doublechecked the prime numbers generated by my sieve for first 5million primes, with 5million primes from https://primes.utm.edu/lists/small/millions/, they check out all of them are correct. But the test cases is giving me WA.


kmkhan_014:
20170828 13:20:24
took 0.6 s...how to improve upon time


harsh123_:
20170125 05:28:13
Use Segmented Sieve...Took only 3.4MB space


madhavgaba:
20170115 19:01:58
how can the top solution be 3.4M and 0.04 sec!!!! 

vivace:
20161222 23:04:16
also , how is the memory use just 3.6 MB for best AC solution as per time limit.. sieve+an array till required takes 22MB in my case 

vivace:
20161222 23:02:54
how are people getting 0.04 seconds while my nloglogn sieve of eratosthenes, several loop counter modifications alongwith scanf and printf got 0.56? 

iharsh234:
20160708 11:44:04
do it just for bitwise seive.


blueranger:
20160615 20:07:19
@Alfonso2 Peterssen Last submitted solution is working perfectly on my machine. Can you please tell me why am I getting WA?

Added by:  Alfonso2 Peterssen 
Date:  20100406 
Time limit:  1.240s 
Source limit:  10000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM32 ASM64 BF CLPS LISP clisp LISP sbcl ERL HASK ICON ICK JSRHINO LUA NEM NICE OBJC OCAML PHP PIKE PRLGswi SCALA SCM guile SCM qobi ST SQLITE TCL WHITESPACE 
Resource:  Thanks to TDuke 