Why my sieve is not built upto 5000000 places

hello @navin
u r accessing index 5000 000 so ur array size should be atleast 5000 001.

still i am getting the output

try cout<<p[5000000];

btw value of n=5000 000 means u need to compute ur sieve upto 5000 000 th prime.
so declare ur sieve size more than 5000 000 th prime number.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

https://ide.codingblocks.com/s/232911 why am i getting segmentation faults

@navin cause you have never pushed prime numbers in your vector but you are accessing it.

https://ide.codingblocks.com/s/232911 still getting segmentation fault

@navin i think using bitset of this much size is not suitable for this problem,
look at this i have updated your code a little