Generate and test for prime numbers.
The pyprimes package offers a variety of algorithms for generating prime numbers and fast primality test, written in pure Python.
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.
pyprimes includes the following features:
- Produce prime numbers lazily, on demand.
- Effective algorithms including Sieve of Eratosthenes, Croft Spiral, and Wheel Factorisation.
- Efficiently test whether numbers are prime, using both deterministic (exact) and probabilistic primality tests.
- Examples of what not to do are provided, including naive trial division, Turner’s algorithm, and primality testing using a regular expression.
- Factorise small numbers into the product of prime factors.
- Suitable for Python 2.4 through 3.2 from one code base.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyprimes-0.2.0a.linux-i686.exe (110.8 kB)||File type Windows Installer||Python version any||Upload date||Hashes View|
|Filename, size pyprimes-0.2.0a.tar.gz (30.9 kB)||File type Source||Python version None||Upload date||Hashes View|