(Segmented Prime Sieve) We are taking index -1

In the video, we have used the start = (m/x)*x trick, so when we put range m = 99 and n = 110, we get start as 98.
Now, we are taking segment[i - m], when i = start, we are trying to get segment[-1]. Why is this not showing any error?
And how can we remove this problem?

@shivambehl123
yes ,you are right
for this you have put one condition
if(start<m)start+=x;/// next multiple of x

1 Like