Restricted Partition
A restricted partition is the subset of an integer partition with only partitions at or below a certain length.
from restricted_partition import iter_partition
iter_partition(5)
# [1, 1, 1, 1, 1]
# [1, 1, 1, 2]
# [1, 1, 3]
# [1, 2, 2]
# [1, 4]
# [2, 3]
# [5]
iter_partition(5, 3)
# [1, 1, 3]
# [1, 2, 2]
# [1, 4]
# [2, 3]
# [5]
Uses the accel_asc algorithm (thank you, Jerome Kelleher), so it is pretty speedy in pure Python.
I found the algorithm at https://jeromekelleher.net/generating-integer-partitions.html.
Metadata
Release files for restricted-partition 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| restricted_partition-0.1.1.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| restricted_partition-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / restricted_partition-0.1.1.tar.gz
| Download URL | restricted_partition-0.1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0de4101cd3d6671e8959d7b9e34df91235c6699633c96999b81d22b2cb158731
|
|
BLAKE2b-256 checksum How to use checksums |
27862e9430384b18e15b21ce4f1e220c3b45976086b413e04f25f6b608c5f61f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.0 Windows/10
|
Release files / restricted_partition-0.1.1-py3-none-any.whl
| Download URL | restricted_partition-0.1.1-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c8ee57e0ba3118c12e3862fcf2e8a7ff57fff433c7e1b83b6085ca41d25d74e
|
|
BLAKE2b-256 checksum How to use checksums |
cb2e85a717c8be1dd38321c76cab4404aeca49bc80b7a30887aec05d12a9b4f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.0 Windows/10
|