Skip to main content

Library to enumerate all natural number lists with a target sum.

PyPI version and link.

Purpose

This library allows programmers to create a generator for all the lists of natural numbers that add up to a target sum.

Package Installation and Usage

The package is available on PyPI:

python -m pip install summations

The library can be imported in the usual way:

import summations
from summations import summations

Testing

The library comes with a number of tests:

nosetests

Examples

An example of usage is provided below:

>>> from summations import summations
>>> sorted(list(sum_len(5, 3)))
[(0, 0, 5), (0, 1, 4), (0, 2, 3), (0, 3, 2), (0, 4, 1), (0, 5, 0),
 (1, 0, 4), (1, 1, 3), (1, 2, 2), (1, 3, 1), (1, 4, 0), (2, 0, 3),
 (2, 1, 2), (2, 2, 1), (2, 3, 0), (3, 0, 2), (3, 1, 1), (3, 2, 0),
 (4, 0, 1), (4, 1, 0), (5, 0, 0)]

Release files for summations 0.0.9.1

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

Source distribution (sdist)

Source distribution for summations 0.0.9.1
File Size Uploaded
summations-0.0.9.1.tar.gz 2.1 kB Details

Built distribution (wheel)

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

Total release size: 5.4 kB

Release files / summations-0.0.9.1.tar.gz

Download URL summations-0.0.9.1.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
95548f6d9d6e5d11939a0413541b729b7e2f0f7eed38d11478f7b84f0646e480
BLAKE2b-256 checksum
How to use checksums
feaeb091fba4289b28d54e0c80065e9f48a075e354e903c6db30678b569465e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

Release files / summations-0.0.9.1-py3-none-any.whl

Download URL summations-0.0.9.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fb6b1717590bc94cbd936f2577be7146a4c6c36b4da51137ba6f1914bffb23c
BLAKE2b-256 checksum
How to use checksums
5f93d8e2a79813e1979a38232e344a85f9cfedc0bc0ad9091beef9b63859b1dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.0.9.1 This release

2 release files

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