Deepak And Primes[Number Theory]


As the constraints are too high therefore I keep the size as 5000005, but then it is giving the segmentation fault.
And when I keep array size to be 1000005, then it will give the correct answer for 4 test cases but showing Run error for rest of the two cases.

Hey,
5,000,000 th prime number is 86,028,121. Thus you need to set the size of ā€œpā€ (in your code) to a number greater than 86,028,121.