interator
Module for integer sequence generation and related conditional tests.
Installation
Use the package manager pip to install interator.
pip install interator
Contents
Fibonacci Sequence
| Function | Description |
|---|---|
fibonacci_stream(start=(0,1)) |
Yield the next Fibonacci number starting with F(0) |
negafibonacci_stream(start=(0,1)) |
Yield the next Fibonacci number in the negative index starting with F(0) |
nth_fibonacci(n, start=(0, 1)) |
Given an index n, find F(n) |
lucas_stream(P = 2, Q = -1, start=(0, 1)) |
Yield the next number in the in the (P,-Q)-Lucas sequence starting with U0(P,Q) |
is_fibonacci(n, start=(0,1)) |
Determine if n is within the Fibonacci sequence |
is_lucas(n, P = 2, Q = -1, start=(0, 1)) |
Determine if n is within the (P,-Q)-Lucas sequence |
Generalizations
By default, fibonacci_stream, negafibonacci_stream, nth_fibonacci, and is_fibonacci work with the Fibonacci numbers, and lucas_stream and is_lucas work with the Pell numbers. However, by changing start, any generalization of these sequences can be generated. Here are some common examples:
import interator
stop = 10
numbers = {'Lucas' : (2, 1),
'Tribonacci' : (0, 0, 1),
'Tetranacci' : (0, 0, 0, 1)}
for name, start in numbers.items():
print('%s numbers:' % name)
for i, n in enumerate(interator.fibonacci_stream(start=start)):
print(n, end = ' ')
if i == stop:
print('\n')
break
Please note the Lucas numbers should not be confused with the Lucas sequence. The Lucas numbers are a specific example of the Lucas sequence.
Prime Numbers
| Functions | Description |
|---|---|
prime_stream() |
Yield the next prime number starting with 2 |
composite_stream() |
Yield the next composite number starting with 1 |
is_prime() |
Test the primality of n by checking potential prime factors |
miller_rabin(n, k = 8) |
Perform the Miller-Rabin Primality Test on n |
is_composite(n) |
Test if n is a composite number by checking potential prime factors |
Polygonal Numbers
| Functions | Description |
|---|---|
polygonal_stream(s) |
Yield the next s-gonal number starting with 1 |
is_polygonal(n, s) |
Test if n is an s-gonal number |
Licensing
This project is licensed under the MIT License.
Metadata
Release files for interator 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| interator-0.3.tar.gz | 4.9 kB | Without provenance | Details for interator-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| interator-0.3-py3-none-any.whl | Python 3 | none | any | Details for interator-0.3-py3-none-any.whl |
Total release size: 11.0 kB
Release files / interator-0.3.tar.gz
| Download URL | interator-0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d709747781034ba38f3fde01d4cb3cafff3ea23f2e70209d9cbbc2c7955ece8c
|
|
BLAKE2b-256 checksum How to use checksums |
84db11b865833cb04dd98a30f733d6756c291556952d3469068b8f35c6d7ca48
|
| 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/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5
|
Release files / interator-0.3-py3-none-any.whl
| Download URL | interator-0.3-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef07dc079c1814f92aa7f5e3619d27c134e6dfff1af0630a8f016abf2fe4d5bf
|
|
BLAKE2b-256 checksum How to use checksums |
86be0aa39316cc3d18631c8e1031a54116d4321a2c6307ca8d44c8b5c094efa7
|
| 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/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5
|
Security for interator 0.3
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.