Sir I dont get why I am getting run time error.
Getting run time error
Can you also confirm if my approach is correct
check the value 500 000 th prime number and declare ur sieve array just bigger than that .and prepare ur sieve onlny upto that.
I changed my sieve to a[LLong_MAX] I think I have to keep it more than 500000 because the 500000th prime will be a much bigger number
But I am still getting error
no it will be somewhere under 10^7,pls find its value from internet.
LL_MAX is 10^18 we cannot declare such big array. to do this->
also in line 26 it should be maxlimit-1 becuase we are usinf 0 based indexing
I made these changes still getting segmentation fault
Thanks It worked perfectly fine
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.