NPRIME - Nth Prime

Given an integer 1 <= N <= 100000, you have to print the Nth prime number.

Score is the length of your source.

Input

The input file consists of series of numbers one in each line.The input is terminated by EOF.

Output

The Nth prime number.

Example

Input: 
3
5
7
11

Output:

5
11
17
31

PS: Timit limit and test cases are modified on 05.10.2010 to encourage more short solution.

Added by::(){ :|: & };:
Date:2010-10-04
Time limit:2s-4.5s
Source limit:256B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 SCM qobi

hide comments
2011-05-08 17:17:12 HWK
Thanks! I tried ideone.com. But there I get SIGSEGV for the eaxample input too. This works well with gfortran 4.4.3 and I don't see a possible cause. Maybe the different fortran versions cause it? With Mingw I also got a not traceable SIGSEGV.
2011-05-08 12:25:02 :(){ :|: & };:
@Hwk:Sorry for belated response,thanks to vipul aka XeRon!X who bring this to my notice.

I am very comfortable to increase the time limit for shorten but not in main challenge since the one of the reason i made this to task is to challenge the contestants to find the shortest solution with a time complexity of at-least O(n(logn)(loglogn)).

I looked into the status of your Fort solution (5044918),it's not the test 1 sig 11 is been generated in the test 0 and I dont' think the judge is processing it further.
2011-05-08 11:57:01 XeRoN!X
@HWK, try running your code on ideone.com ( SPOJ platform ).
2011-05-04 06:27:43 HWK
@.:: Debanjan ::. : For fun I tested a solution with Fortran. At home there are no problems (ubuntu gfortran 4.4.3) even with N=100000. Here it results in SIGSEGV in judge 1. Judge 0 seems to run. Could you see what causes the problem?
2010-11-18 18:47:44 HWK
I agree with Piotr. I found a shorter solution with Bash, which is too slow for the limit. But I think the challenge should be to write short code not fast. So why not extend the limit?
2010-11-15 15:10:08 :(){ :|: & };:

It's a challenge task in the main contest so I think the time limit is quite good enough :-)

Last edit: 2010-11-15 15:13:02
2010-11-10 16:11:20 Piotr Fusik
Could you please extend the time limit?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.