Primality helps you easily find, test and work with prime numbers in Python.
Project description
Primality
Primality helps you easily find, test and work with prime numbers in Python.
primality.isprime(516349073509121311)
>> True
primality.nthprime(9999)
>> 104729
primality.prange(10)
>> [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
Installation
Use the package manager pip to install Primality.
pip install primality
Implementation
Primality officially supports Python 3.8+.
from primality import primality
Usage
isprime(p: int) True if {p} is prime.
primality.isprime(13)
>> True
primality.isprime(20)
>> False
primality.isprime(516349073509121311)
>> True
nthprime(nth: int) Returns the {nth} prime, starting from n = 0, returning 2.
primality.nthprime(0)
>> 2
primality.nthprime(100)
>> 547
primality.nthprime(9999)
>> 104729
prange(n: int) Returns a list with the form of [2, 3, ..., {n}th prime].
primality.prange(3)
>> [2, 3, 5]
primality.prange(10)
>> [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file primality-0.0.6.tar.gz.
File metadata
- Download URL: primality-0.0.6.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29f6ebb708183a62545c960d4b7751843836e917a3f245c6f799199e806c9f99
|
|
| MD5 |
072aba8d847a1bfc38152037dc816027
|
|
| BLAKE2b-256 |
f3d20dc66e373def9f647aedabab84a1888f176cbc56d2cc144cc1ae44f8bb21
|
File details
Details for the file primality-0.0.6-py3-none-any.whl.
File metadata
- Download URL: primality-0.0.6-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddc1c49af3220b46adb334da0dceccc999075f45239c739ed6a2459adf28d82d
|
|
| MD5 |
58a6b8a05c741535bb3f8c9466750622
|
|
| BLAKE2b-256 |
a58d370b04d88051f6ce4c563935019d77feff957677746570a665deb6eede9f
|