Skip to content

Instantly share code, notes, and snippets.

@kimwalisch
Last active March 6, 2018 10:46
Show Gist options
  • Save kimwalisch/57e0440fb568dfe4be3865f26f566f7d to your computer and use it in GitHub Desktop.
Save kimwalisch/57e0440fb568dfe4be3865f26f566f7d to your computer and use it in GitHub Desktop.
Outer sieving loop
for (int64_t low = 0; low <= limit; low += segment_size)
{
std::fill(sieve.begin(), sieve.end(), true);
// current segment = [low, high]
int64_t high = low + segment_size - 1;
high = std::min(high, limit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment