diff options
author | aqua <aqua@iserlohn-fortress.net> | 2023-03-18 07:17:27 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2023-03-18 07:25:29 +0200 |
commit | 57027fd076504b219f3e886e78535191f6abbb66 (patch) | |
tree | 5166eb58a4ddc86b2865b104f7b7c81529769dab /sieve.hh | |
download | primes-master.tar.xz |
Sieve of Eratosthenes
- simple implementation and optimized versions
- Segmented sieve with pthreaded version
Diffstat (limited to 'sieve.hh')
-rw-r--r-- | sieve.hh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sieve.hh b/sieve.hh new file mode 100644 index 0000000..c3e6c14 --- /dev/null +++ b/sieve.hh @@ -0,0 +1,11 @@ +#pragma once + +#include <vector> + +[[nodiscard]] bool isPrime(std::size_t x); + +[[nodiscard]] std::vector<int> sieve1(std::size_t size); +[[nodiscard]] std::vector<int> sieve2(std::size_t size); +[[nodiscard]] std::vector<int> sieve3(std::size_t size); +[[nodiscard]] std::vector<int> segmentedSieve(std::size_t size); +[[nodiscard]] std::vector<int> pthreadSieve(std::size_t size); |