primegenerators


Nameprimegenerators JSON
Version 0.0.7 PyPI version JSON
download
home_pageNone
SummaryA library of prime number generators and analyzers, that also has a command-line interface
upload_time2024-12-20 07:34:39
maintainerNone
docs_urlNone
authorbig-jr
requires_python<4.0,>=3.10
licenseApache-2.0
keywords prime numbers generator cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

```bash
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.:

```python
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

```python
primes() -> Iterator[int]
```

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

Returns an iterator over the series of prime numbers.

```python
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.

```python
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`

```python
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](https://static.pepy.tech/badge/primegenerators)](https://pepy.tech/project/primegenerators)
[![Downloads](https://static.pepy.tech/badge/primegenerators/month)](https://pepy.tech/project/primegenerators)
[![Downloads](https://static.pepy.tech/badge/primegenerators/week)](https://pepy.tech/project/primegenerators)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "primegenerators",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "prime, numbers, generator, cli",
    "author": "big-jr",
    "author_email": "githubcomms@softwarepragmatism.com",
    "download_url": "https://files.pythonhosted.org/packages/43/4c/e1d57c33eb7c17ce849605821608b5181fd75708258b4aa1b959eef8992f/primegenerators-0.0.7.tar.gz",
    "platform": null,
    "description": "# PrimeGenerators - Prime Number Generation and Utilities\n\n## Command Line Interface\n\nThe prime generator can be run from the command line. The output can be piped or redirected to a separate file or\nprocess.\n\n```bash\nusage: primegenerators [-h] [-c COUNT] [-f {text,json}]\n\nRandom number generator and analyzer.\n\noptions:\n  -h, --help            show this help message and exit\n  -c COUNT, --count COUNT\n                        The number of values to generate\n  -f {text,json}, --format {text,json}\n                        The format of the output\n```\n\n## Python Library\n\nThe prime generator should be created using the factory method, e.g.:\n\n```python\nfrom primegenerators import get_generator\n\n# Details elided\n\ngenerator = get_generator(\"eratosthenes\")\n\nfor index, prime in enumerate(generator.primes()):\n    sys.stdout.write(str(prime))\n\n    # Further processing and exit conditions\n```\n\n### Member Functions\n\n```python\nprimes() -> Iterator[int]\n```\n\nGenerate an endless series of prime numbers, starting with 2.\n\nReturns an iterator over the series of prime numbers.\n\n```python\nprimes_range(minimum: int, maximum: int) -> Iterator[int]\n```\n\nReturn an iterator over the series of prime numbers between minimum\nand maximum inclusive.\n\n**minimum:** The minimum number in the series. If this number is not prime,\nthe first number in the series is the first prime higher than this number.\n\n**maximum:** The maximum number in the series. If this number is not prime,\nthe last number in the series is the last prime lower than this number.\n\n```python\nis_prime(number: int) -> bool\n```\n\nDetermine whether a given number is prime or not.\n\n**number:** The number to be checked for prime-ness\n\nReturns `True` if the candidate number is prime, otherwise `False`\n\n```python\nprime_factors(self, number: int) -> Counter\n```\n\nCalculate the prime factors of a number.\n\n**number:** The number to be factorized\n\nReturns a `collections.Counter` object containing the prime factors of `number`\n\n## Download Statistics\n\n[![Downloads](https://static.pepy.tech/badge/primegenerators)](https://pepy.tech/project/primegenerators)\n[![Downloads](https://static.pepy.tech/badge/primegenerators/month)](https://pepy.tech/project/primegenerators)\n[![Downloads](https://static.pepy.tech/badge/primegenerators/week)](https://pepy.tech/project/primegenerators)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A library of prime number generators and analyzers, that also has a command-line interface",
    "version": "0.0.7",
    "project_urls": null,
    "split_keywords": [
        "prime",
        " numbers",
        " generator",
        " cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d26f9e99f37f32c1a606df329ed2a3bcbf88271ddf80fc5eee51ae6c39eb47d0",
                "md5": "a008e115721687b90567f6929fb91ff4",
                "sha256": "8c480b59c9115ea9d139d87d5aa245cbc30ed134891e81a896bd43deaa52ed14"
            },
            "downloads": -1,
            "filename": "primegenerators-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a008e115721687b90567f6929fb91ff4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 6701,
            "upload_time": "2024-12-20T07:34:37",
            "upload_time_iso_8601": "2024-12-20T07:34:37.681768Z",
            "url": "https://files.pythonhosted.org/packages/d2/6f/9e99f37f32c1a606df329ed2a3bcbf88271ddf80fc5eee51ae6c39eb47d0/primegenerators-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "434ce1d57c33eb7c17ce849605821608b5181fd75708258b4aa1b959eef8992f",
                "md5": "75ed71ac34c381e9cfe7b4b3634d537b",
                "sha256": "7196d74faa6e0b64b5ae3e918317833ba91e7dbc6d3d93fdf3262d737b0a7f04"
            },
            "downloads": -1,
            "filename": "primegenerators-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "75ed71ac34c381e9cfe7b4b3634d537b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 11003,
            "upload_time": "2024-12-20T07:34:39",
            "upload_time_iso_8601": "2024-12-20T07:34:39.937131Z",
            "url": "https://files.pythonhosted.org/packages/43/4c/e1d57c33eb7c17ce849605821608b5181fd75708258b4aa1b959eef8992f/primegenerators-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-20 07:34:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "primegenerators"
}
        
Elapsed time: 0.40948s