Deepak and prime, find nth prime no

here is my code
https://ide.codingblocks.com/s/48247
last two test cases are not getting passed. couldn’t figure out the reason

Hey Yash, you have haven’t handled the corner cases, for eg.
input :1
output should be : 2
but your code’s output is : 0

One more thing is it is given in the problem that n <= 5000000 but you have made the sieve of size 500000 only, so it will not be able to give an answer for larger numbers.

1 Like

code’s output is 2 for input=1.
Also tell me how to handle such a large n and how do i figure out from given n, what should be the size of sieve ?

Manually compute the number of primes using prime sieve on some ide , you will get the distribution of primes .