summaryrefslogtreecommitdiff
path: root/sieve.hh
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2023-03-18 07:17:27 +0200
committeraqua <aqua@iserlohn-fortress.net>2023-03-18 07:25:29 +0200
commit57027fd076504b219f3e886e78535191f6abbb66 (patch)
tree5166eb58a4ddc86b2865b104f7b7c81529769dab /sieve.hh
downloadprimes-master.tar.xz
Initial commitHEADmaster
Sieve of Eratosthenes - simple implementation and optimized versions - Segmented sieve with pthreaded version
Diffstat (limited to 'sieve.hh')
-rw-r--r--sieve.hh11
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);