An open API service indexing awesome lists of open source software.

https://github.com/konaeakira/prime-sieve

A somewhat fast C++ implementation of a prime sieve.
https://github.com/konaeakira/prime-sieve

eratosthenes prime-sieve primesieve

Last synced: about 1 month ago
JSON representation

A somewhat fast C++ implementation of a prime sieve.

Awesome Lists containing this project

README

        

# prime-sieve

## Description
A somewhat fast C++ implementation of a prime sieve.

Not meant for production. This is just the result of some teenager with too much time on their hands.

The algorithm uses the segmented sieve of Eratosthenes with bucket sieve and a modulo 210 wheel.

## Benchmarks
Average time to find all primes below `1e9`.

Submit a pull request to add your benchmarks.

CPU | Single-Threaded | Multi-Threaded
:---: | ---: | ---: |
Intel i5-8265U | 870 ms | 192 ms
Intel i7-7700 | 787 ms | 159 ms

## Compiling
Most compilers with C++17 will do.
#### Linux
```
g++ -std=c++17 -Ofast -pthread main.cpp -o prime-sieve
```
#### Windows
Please use Linux.

## License
This program is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.