Skip to main content

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]

Metadata

Release files for primality 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for primality 0.0.6
File Size Uploaded Provenance
primality-0.0.6.tar.gz 2.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for primality 0.0.6
File Interpreter ABI Platform
primality-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 6.4 kB

Release files / primality-0.0.6.tar.gz

Download URL primality-0.0.6.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
29f6ebb708183a62545c960d4b7751843836e917a3f245c6f799199e806c9f99
BLAKE2b-256 checksum
How to use checksums
f3d20dc66e373def9f647aedabab84a1888f176cbc56d2cc144cc1ae44f8bb21
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / primality-0.0.6-py3-none-any.whl

Download URL primality-0.0.6-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddc1c49af3220b46adb334da0dceccc999075f45239c739ed6a2459adf28d82d
BLAKE2b-256 checksum
How to use checksums
a58d370b04d88051f6ce4c563935019d77feff957677746570a665deb6eede9f
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for primality 0.0.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page