Skip to main content

PrimeGenerators - Prime Number Generation and Utilities

Command Line Interface

The prime generator can be run from the command line. The output can be piped or redirected to a separate file or process.

usage: primegenerators [-h] [-c COUNT] [-f {text,json}]

Random number generator and analyzer.

options:
  -h, --help            show this help message and exit
  -c COUNT, --count COUNT
                        The number of values to generate
  -f {text,json}, --format {text,json}
                        The format of the output

Python Library

The prime generator should be created using the factory method, e.g.:

from primegenerators import get_generator

# Details elided

generator = get_generator("eratosthenes")

for index, prime in enumerate(generator.primes()):
    sys.stdout.write(str(prime))

    # Further processing and exit conditions

Member Functions

primes() -> Iterator[int]

Generate an endless series of prime numbers, starting with 2.

Returns an iterator over the series of prime numbers.

primes_range(minimum: int, maximum: int) -> Iterator[int]

Return an iterator over the series of prime numbers between minimum and maximum inclusive.

minimum: The minimum number in the series. If this number is not prime, the first number in the series is the first prime higher than this number.

maximum: The maximum number in the series. If this number is not prime, the last number in the series is the last prime lower than this number.

is_prime(number: int) -> bool

Determine whether a given number is prime or not.

number: The number to be checked for prime-ness

Returns True if the candidate number is prime, otherwise False

prime_factors(self, number: int) -> Counter

Calculate the prime factors of a number.

number: The number to be factorized

Returns a collections.Counter object containing the prime factors of number

Download Statistics

Downloads Downloads Downloads

Metadata

Release files for primegenerators 0.0.11

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

Source distribution (sdist)

Source distribution for primegenerators 0.0.11
File Size Uploaded Provenance
primegenerators-0.0.11.tar.gz 11.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 18.7 kB

Release files / primegenerators-0.0.11.tar.gz

Download URL primegenerators-0.0.11.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
21b2efdbe5336f5aeb4594c9a21024ebe9a0280b8b9823be6a28ed464d101419
BLAKE2b-256 checksum
How to use checksums
6e14d1c5c64d8e50ed00b9dab245c082a34ceca43f6460fb40e382288019669b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.7 Linux/6.11.0-13-generic

Release files / primegenerators-0.0.11-py3-none-any.whl

Download URL primegenerators-0.0.11-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90f7d86faea7372f4d075d7fdd544ad6739b1733ecb307c928e6841985896d4d
BLAKE2b-256 checksum
How to use checksums
12ad5394bb0ce147d1b0241ea6665da3d166447a312715f2dd1cc163c065d8bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.7 Linux/6.11.0-13-generic

Security for primegenerators 0.0.11

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.

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