polymerist.maths.combinatorics.partitions

For explicitly enumerating partitions of sets and multisets

Functions

int_partitions(→ Generator[tuple[int], None, None])

Enumerates all integer partitions of n

multiset_partition(→ Generator[tuple[int], None, None])

Enumerates all multisets of k integers whose sum is n (respects order and includes 0s)

make_change_greedy(→ dict[int, int])

Greedy algorithm for making change for a given total

Module Contents

polymerist.maths.combinatorics.partitions.int_partitions(n: int, _pivot: int = 1) Generator[tuple[int], None, None][source]

Enumerates all integer partitions of n

polymerist.maths.combinatorics.partitions.multiset_partition(n: int, k: int) Generator[tuple[int], None, None][source]

Enumerates all multisets of k integers whose sum is n (respects order and includes 0s)

polymerist.maths.combinatorics.partitions.make_change_greedy(n: int, denoms: Sequence[int]) dict[int, int][source]

Greedy algorithm for making change for a given total