Deepak and prime problem

https://ide.codingblocks.com/s/53797

sir, my code is passing only 3 test cases, how to rectify the error ?

Hi, your code is not giving any output for big numbers like 5000000.

Hey Yukti, read the constraints carefully, it is given that 1<=n<=5000000, but you are taking the max size of primesieve 10000 only, so when you will try to find the output for bigger n in primesieve it will be out of range of its size and results in run error.

https://ide.codingblocks.com/s/54436

i tried to run this code, but it is showing no-output in last two cases…

Hey Yukti, as n in input is large and nth prime doesn’t come under the range of your N, so your code is not giving any output for larger cases. To correct this update the variable N’s value as N = 100000000 and declare the array as a global array.

https://ide.codingblocks.com/s/54436

it is still not passing one test case…

Hey Yukti, that’s because you haven’t declared the array as a global array.