Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Generate and test for prime numbers.

Project description

Compare a variety of algorithms for generating and testing prime numbers with the pure-Python module pyprimes.

Prime numbers are those positive integers which are not divisible exactly by any number other than itself or one. Generating primes and testing for primality has been a favourite mathematical pastime for centuries, as well as of great practical importance for encrypting data.

Features of pyprimes:

  • Produce prime numbers lazily, on demand.
  • Effective, fast algorithms including Sieve of Eratosthenes, Croft Spiral, and Wheel Factorisation.
  • Test whether numbers are prime efficiently.
  • Deterministic and probabilistic primality tests.
  • Examples of what not to do provided, including trial division, Turner’s algorithm, and primality testing using a regular expression.
  • Factorise numbers into the product of prime factors.
  • Suitable for Python 2.5 through 3.2 from one code base.

Project details

Release history Release notifications

History Node


History Node


History Node


This version
History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyprimes-0.1.1a.linux-i686.exe (75.4 kB) Copy SHA256 hash SHA256 Windows Installer any Feb 22, 2012
pyprimes-0.1.1a.tar.gz (13.2 kB) Copy SHA256 hash SHA256 Source None Feb 22, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page