Skip to content

Commit e8072fc

Browse files
author
Volodymyr Sachko
committed
Index initialization improvement
1 parent 2dd87f7 commit e8072fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/algebra/sieve-of-eratosthenes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ vector<char> segmented_sieve(long long L, long long R) {
222222
223223
vector<char> isPrime(R - L + 1, true);
224224
for (long long i : primes)
225-
for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
225+
for (long long j = max(i, (L + i - 1) / i) * i; j <= R; j += i)
226226
isPrime[j - L] = false;
227227
if (L == 0)
228228
isPrime[L] = false;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy