Name | primegenerators JSON |
Version |
0.0.11
JSON |
| download |
home_page | None |
Summary | A library of prime number generators and analyzers, that also has a command-line interface |
upload_time | 2024-12-29 04:11:47 |
maintainer | None |
docs_url | None |
author | big-jr |
requires_python | <4.0,>=3.12 |
license | Apache-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.12",
"maintainer_email": null,
"keywords": "prime, numbers, generator, cli",
"author": "big-jr",
"author_email": "githubcomms@softwarepragmatism.com",
"download_url": "https://files.pythonhosted.org/packages/6e/14/d1c5c64d8e50ed00b9dab245c082a34ceca43f6460fb40e382288019669b/primegenerators-0.0.11.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.11",
"project_urls": null,
"split_keywords": [
"prime",
" numbers",
" generator",
" cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "12ad5394bb0ce147d1b0241ea6665da3d166447a312715f2dd1cc163c065d8bd",
"md5": "1bfb5ae3a0b1306f89188b472b5dff8f",
"sha256": "90f7d86faea7372f4d075d7fdd544ad6739b1733ecb307c928e6841985896d4d"
},
"downloads": -1,
"filename": "primegenerators-0.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1bfb5ae3a0b1306f89188b472b5dff8f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 6848,
"upload_time": "2024-12-29T04:11:45",
"upload_time_iso_8601": "2024-12-29T04:11:45.224455Z",
"url": "https://files.pythonhosted.org/packages/12/ad/5394bb0ce147d1b0241ea6665da3d166447a312715f2dd1cc163c065d8bd/primegenerators-0.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6e14d1c5c64d8e50ed00b9dab245c082a34ceca43f6460fb40e382288019669b",
"md5": "14a35f361ab4b88b21c26f84809bbc3b",
"sha256": "21b2efdbe5336f5aeb4594c9a21024ebe9a0280b8b9823be6a28ed464d101419"
},
"downloads": -1,
"filename": "primegenerators-0.0.11.tar.gz",
"has_sig": false,
"md5_digest": "14a35f361ab4b88b21c26f84809bbc3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 11872,
"upload_time": "2024-12-29T04:11:47",
"upload_time_iso_8601": "2024-12-29T04:11:47.466090Z",
"url": "https://files.pythonhosted.org/packages/6e/14/d1c5c64d8e50ed00b9dab245c082a34ceca43f6460fb40e382288019669b/primegenerators-0.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-29 04:11:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "primegenerators"
}