there is a run error in 2 of the testcases. Please check it. I think it is related to the size of the array as it is too big. What shall i do in it’s place? This is the code:- https://ide.codingblocks.com/s/215654
Array size too big
Hi,
n is of the order 10^6 then you should not consider array of such large size.
but n is the nth prime number and not the limit, so the range would be much larger that is why i took such a big array
Yes you are correct.
To store large size u can use bitset. since, 5,000,000 th prime number is 86,028,121 u can create a bitset of order 10^8. Now, try to solve this question.
moreover array of size 5000000 is also creating problems
I have made changes in your code:
sir even your code is giving segmentation fault
ok on submitting it is working