Skip to main content

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

primality-0.0.6.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

primality-0.0.6-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

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

Hashes for primality-0.0.6.tar.gz
Algorithm Hash digest
SHA256 29f6ebb708183a62545c960d4b7751843836e917a3f245c6f799199e806c9f99
MD5 072aba8d847a1bfc38152037dc816027
BLAKE2b-256 f3d20dc66e373def9f647aedabab84a1888f176cbc56d2cc144cc1ae44f8bb21

See more details on using hashes here.

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

Hashes for primality-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ddc1c49af3220b46adb334da0dceccc999075f45239c739ed6a2459adf28d82d
MD5 58a6b8a05c741535bb3f8c9466750622
BLAKE2b-256 a58d370b04d88051f6ce4c563935019d77feff957677746570a665deb6eede9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page