segmentation error
Prateek loves candy
u have made prime array small that’s why when it asks for something greater than 10001 it cannot access it in ur prime array and gives segmentation error. It is said that n can be as large as 10^6. U are dealing with a large number so make the array larger so that atleat 10^6 primes are present there.