One test case failing i think there is problem with size of array

The 500,000th prime is 7,368,787.
so size of array should be 7400005
and use n=7400000

after that it should pass all testcase

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:
if you have more doubts regarding this feel free to ask

would use of bitset be benificial in place of array ???

now its showing run time error

yes it will be space optimised
and after that i will not give run time errror

updating size of array shows run time error

make array p as bool instead of ll
as it store only 0 and 1