Content-Length: 259024 | pFad | http://github.com/cp-algorithms/cp-algorithms/commit/e8072fc5b2cf3b088cd36bf495bb85916f25f939

2B Index initialization improvement · cp-algorithms/cp-algorithms@e8072fc · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/cp-algorithms/cp-algorithms/commit/e8072fc5b2cf3b088cd36bf495bb85916f25f939

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy