Why I am getting segmentation fault ?
Prime Visits problem
-
you need to call sieve function only at once
-
use long long int instead of int
-
also make bool array instead of int array as you only need to stroe 0 and 1
Modified Code
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask
What will be the time complexity of modified code ?
it is O(n*log(log(n));
for explanation see this i have recently solve this doubt
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask