Prime generator


please check my code, I am unable to find the error

Please check my doubt

Hey @Ajitverma1503,

You are using the Sieve of Eratosthenes approach, this approach will give TLE on big numbers. Try with another approach else your code will work for small numbers (numbers < 10^7).

Please suggest some better approach

I tried it with basic approach and it worked. Here is the code, If you have any doubt you may ask.

code link is not opening

CODE.
Sharing the CPP code of the problem. Try implementing it in python.