Pseudoprimes
Test and find prime numbers.
>>> import pseudoprimes
>>> pseudoprimes.is_prime(11)
True
>>> pseudoprimes.is_prime(1022117) # 1009*1013
False
>>> pseudoprimes.get_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 primality test1 is deterministic until ~3.3 * 10^242 (or ~1.37 * 2^81). Numbers larger than that are tested using a probabilistic Baillie–PSW primality test3. While there are no known composite numbers that pass the test, it's believed they exist.
-
https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Deterministic_variants ↩
-
The exact number is 3,317,044,064,679,887,385,961,981 https://oeis.org/A014233 ↩
-
https://en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_test ↩
Metadata
Release files for pseudoprimes 2022.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pseudoprimes-2022.5.1.tar.gz | 8.7 kB | Without provenance | Details for pseudoprimes-2022.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pseudoprimes-2022.5.1-py3-none-any.whl | Python 3 | none | any | Details for pseudoprimes-2022.5.1-py3-none-any.whl |
Total release size: 18.0 kB
Release files / pseudoprimes-2022.5.1.tar.gz
| Download URL | pseudoprimes-2022.5.1.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca25b7b50b5f639062feabda55ecee626af46f9ad5c47abe6f78fd4c302a1866
|
|
BLAKE2b-256 checksum How to use checksums |
137bc0991d1a25ec661b75af33fd871067f47e6c7adb9323d2b8b87f4f410035
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / pseudoprimes-2022.5.1-py3-none-any.whl
| Download URL | pseudoprimes-2022.5.1-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca8bd80c2d58e59f39a1618184116c9fce54799cbbfc191a997d40f4e47e4ead
|
|
BLAKE2b-256 checksum How to use checksums |
fc391067803ca409236b11f9462014993da347b2b6f1b4346c35664ce3f7ebda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Security for pseudoprimes 2022.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.