Skip to main content

Fast prime generation for Python based on Sieve of Eratosthenes and Trial Division

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Eratosthenes-3.0.11.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file Eratosthenes-3.0.11.tar.gz.

File metadata

  • Download URL: Eratosthenes-3.0.11.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for Eratosthenes-3.0.11.tar.gz
Algorithm Hash digest
SHA256 df351a2af2b883125ec02e495d22f72b02e0d9141da9881f99bcb8aab52abf93
MD5 f93dcb352c21c85ff7b336998b91db68
BLAKE2b-256 f27505e1e42fde66301a9d3ac01a1af68cb4aa7ab3a9340c1ebac541ac8abe34

See more details on using hashes here.

File details

Details for the file Eratosthenes-3.0.11-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for Eratosthenes-3.0.11-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5625dd6fe823d96b6addaf86e2a2678c2ec29114d46e6dabab6ddd46a2de47e
MD5 3858dc1b5175427fa8edfccb0602d7bf
BLAKE2b-256 83e8096516774d0a1fa5f3348ae4c24432a835f14cff2faa443556e9d888bd71

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page