Skip to content

Commit

Permalink
Update to latest libprimesieve
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Nov 9, 2024
1 parent f412e1a commit 1ce6553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/primesieve/include/primesieve/PreSieve_Tables.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///
/// @file PreSieve_Table.hpp
/// @file PreSieve_Tables.hpp
/// @brief Pre-sieve multiples of small primes < 100 to speed up the
/// sieve of Eratosthenes. The idea is to allocate several
/// arrays (buffers_) and remove the multiples of small primes
Expand Down Expand Up @@ -104,7 +104,7 @@ int main()
if (j + 1 < buffers[i].size())
std::cout << (((j+1) % 20 == 0) ? "," : ", ");
}
std::cout << " }," << std::endl;
std::cout << (i + 1 < buffers.size() ? " }," : " }") << std::endl;
}

std::cout << "}};" << std::endl;
Expand Down Expand Up @@ -10860,7 +10860,7 @@ const primesieve::Array<std::initializer_list<uint8_t>, 8> buffers =
0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xf7, 0xff, 0xff, 0xbf,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff },
0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff }
}};

} // namespace
Expand Down
14 changes: 8 additions & 6 deletions lib/primesieve/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@
buckets and only when there are no more buckets in the stock the
MemoryPool will allocate new buckets.

* **PreSieve** is used to pre-sieve multiples of small primes < 100
to speed up the sieve of Eratosthenes. Upon creation the
multiples of small primes are removed from multiple buffers. Then
whilst sieving, we perform a bitwise AND on the buffer arrays
and store the result in the sieve array. Pre-sieving provides a
speedup of up to 30% when sieving the primes < 10^10.
* **PreSieve** is used to pre-sieve multiples of small primes < 100 to speed
up the sieve of Eratosthenes. The ```PreSieve_Tables.hpp``` header contains
8 static lookup tables which have been sieved using the primes < 100. Each
of these lookup tables has a size of about 32 kilobytes and the total size
of all pre-sieve lookup tables is about 200 kilobytes. Whilst sieving, we
perform a bitwise AND of the pre-sieve lookup tables and store the result in
the sieve array. Pre-sieving provides a speedup of up to 30% when sieving
the primes < 10^10.

* **SievingPrimes** is used to generate the sieving primes ≤ sqrt(stop).
SievingPrimes is used by the CountPrintPrimes and PrimeGenerator classes.
Expand Down

0 comments on commit 1ce6553

Please sign in to comment.