Skip to content

Fast prime generation for Python based on Sieve of Eratosthenes

License

Notifications You must be signed in to change notification settings

vm6502q/Eratosthenes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eratosthenes

Fast prime generation for Python based on Sieve of Eratosthenes

Usage

from eratosthenes import sieve, count, segmented_sieve, segmented_count

# This is a Sieve of Eratosthenes with wheel factorization.
primes = sieve(1000)

# This uses the same logic to count primes up the argument.
num_primes = count(1000)

# This segmented sieve only uses up to 128 KB main memory
primes = segmented_sieve(1000)
num_primes = segmented_count(1000)

About

Eratosthenes is written in C++17 and bound for Python with pybind11. This makes it faster than just about any native Python implementation of Sieve of Eratosthenes or Trial Division!

Copyright

Copyright (c) Daniel Strano and the Qrack contributors 2017-2024. All rights reserved.

Eratosthenes is provided under an MIT License.

About

Fast prime generation for Python based on Sieve of Eratosthenes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published