From 57027fd076504b219f3e886e78535191f6abbb66 Mon Sep 17 00:00:00 2001 From: aqua Date: Sat, 18 Mar 2023 07:17:27 +0200 Subject: Initial commit Sieve of Eratosthenes - simple implementation and optimized versions - Segmented sieve with pthreaded version --- sieve.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sieve.hh (limited to 'sieve.hh') 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 + +[[nodiscard]] bool isPrime(std::size_t x); + +[[nodiscard]] std::vector sieve1(std::size_t size); +[[nodiscard]] std::vector sieve2(std::size_t size); +[[nodiscard]] std::vector sieve3(std::size_t size); +[[nodiscard]] std::vector segmentedSieve(std::size_t size); +[[nodiscard]] std::vector pthreadSieve(std::size_t size); -- cgit v1.2.1