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.
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.28.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for pseudoprimes-2022.4.28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfca843b81cf16f5c30a30ca733f77a6ae6096cb5aed2c1cc7ef191e80eb74ce |
|
MD5 | 729ef96aae05c6b9cda6fc0d3f1c1a9a |
|
BLAKE2b-256 | edda4b943389f9ba9c48f6836fb307b7831e47ebc5b200745be706c081a0e2d8 |