If start is less than m will it not give a error…shouldn’t we check if start is less than m first
Problem related to segmented sieve code as given in video
for (auto x : primes)
{
// end point to stop iterating the primes
if (x * x > n)
break;
int start = (m / x) * x;
// if the number is the prime itself start from next multiple
if (x >= m and x <= n)
{
start = x * 2;
}
for (ll i = start; i <= n; i += x)
{
segment[i - m] = 1;
}
}
start will not be less than m at any point in the code
start = (m/x)*x
will give value give value greater than equal to m