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.
isprime(516349073509121311)
>> True
nthprime(9999)
>> 104729
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+.
import primality
Usage
isprime(p: int) True if {p} is prime.
isprime(13)
>> True
isprime(20)
>> False
isprime(516349073509121311)
>> True
nthprime(nth: int) Returns the {nth} prime, starting from n = 0, returning 2.
nthprime(0)
>> 2
nthprime(100)
>> 547
nthprime(9999)
>> 104729
prange(n: int) Returns a list with the form of [2, 3, ..., {n}th prime].
prange(3)
>> [2, 3, 5]
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
primality-0.0.1.tar.gz
(1.6 kB
view hashes)
Built Distribution
Close
Hashes for primality-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30fc0da8fc02d6d357ecc55cee48a2e7289178aa52eb08b2d3f2ab0d9bc02cf8 |
|
MD5 | 814fc9bbc16eedfb02b343d36825fa32 |
|
BLAKE2b-256 | cb610b1229df4e89c5c1a31b77ef339a6a54ad268c715e52c0af53ef6439a594 |