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.
- Host: GitHub
- URL: https://github.com/konaeakira/prime-sieve
- Owner: KonaeAkira
- License: mit
- Created: 2018-03-23T02:37:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-19T13:51:32.000Z (about 5 years ago)
- Last Synced: 2025-01-29T12:11:21.498Z (3 months ago)
- Topics: eratosthenes, prime-sieve, primesieve
- Language: C++
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.