Skip to content

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

License

Notifications You must be signed in to change notification settings

KonaeAkira/prime-sieve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 file for details.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published