Test and find prime numbers
Project description
Pseudoprimes
Test and find prime numbers.
>>> import pseudoprimes
>>> pseudoprimes.is_prime(11)
True
>>> pseudoprimes.is_prime(1022117)
False
>>> pseudoprimes.gen_prime(128) # 128-bit prime
181872728983755108091298489166590324849
>>> pseudoprimes.next_prime(3)
5
>>> pseudoprimes.prev_prime(100)
97
Installation
pip install pseudoprimes
Probabilistic or deterministic?
The used Miller–Rabin algorithm^1 is deterministic for values up to 3,317,044,064,679,887,385,961,981. Numbers larger than that are tested using a probabilistic primality test^2.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pseudoprimes-2022.4.29.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for pseudoprimes-2022.4.29-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aff7a60c6da92f62025ac26095a63e66db5f911c930afc0ca578905a6c19c5c |
|
MD5 | 219ea089c6afd35936429d12d5e579e8 |
|
BLAKE2b-256 | 02b96b1d471717fd55e6da1fbc8fb14448bc2067dd5ded236848e80352c9e68d |