Skip to main content

PyPrimer

A simple collection of prime number related functions.

Install

$ pip install pyprimer

For bleeding edge

$ pip install git+https://github.com/mentix02/pyprimer

Docs

  • is_prime(int) -> bool
    • Checks if given number n is prime.
>>> from pyprimer import is_prime
>>> is_prime(3)
True
  • primes_till(int) -> List[int]
    • Returns a list of all primes numbers up until n.
>>> from pyprimer import primes_till
>>> primes_till(6)
[2, 3, 5, 7]
  • n_primes(int) -> List[int]
    • Returns a list of first n natural primes numbers.
>>> from pyprimer import n_primes
>>> n_primes(6)
[2, 3, 5, 7, 11, 13]
  • n_prime(int) -> int
    • Returns the nth prime number.
>>> from pyprimer import n_prime
>>> n_prime(13)
41
  • prime_generator() -> Iterator[int]
    • Returns an iterable of ints with each next element being the next prime number.
>>> from pyprimer import prime_generator
>>> total = 0
>>> g = prime_generator()
>>> for n in g:
...   if n == 13:
...     break
...   total += n
>>> print(total)
28

Metadata

Release files for pyprimer 0.1.0

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

Source distribution (sdist)

Source distribution for pyprimer 0.1.0
File Size Uploaded Provenance
pyprimer-0.1.0.tar.gz 2.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 4.5 kB

Release files / pyprimer-0.1.0.tar.gz

Download URL pyprimer-0.1.0.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
865d9cf6de71f13cfb8c971150b0d9ea82d783b70eb146f43afce8ec51070d7b
BLAKE2b-256 checksum
How to use checksums
1c81c7ec7aa21751095c0a8ab699c8089f8075212b0bdbc8b70de3355c4e5de1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

Release files / pyprimer-0.1.0-py3-none-any.whl

Download URL pyprimer-0.1.0-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81bbd8d36b04d944d5d3f50a3cbf30e2596f8fdc834d1e18d882c4aba443b52a
BLAKE2b-256 checksum
How to use checksums
52828b4bf5da0fee7c88c88001cd5ab53fd39b3ba186abc7923fb9d7f543b5c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

Security for pyprimer 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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