mathtools.yield_all_partitions_of_integer

abjad.tools.mathtools.yield_all_partitions_of_integer.yield_all_partitions_of_integer(n)[source]

New in version 2.0.

Yield all partitions of positive integer n in descending lex order:

abjad> from abjad.tools import mathtools
abjad> for partition in mathtools.yield_all_partitions_of_integer(7):
...     partition
...
(7,)
(6, 1)
(5, 2)
(5, 1, 1)
(4, 3)
(4, 2, 1)
(4, 1, 1, 1)
(3, 3, 1)
(3, 2, 2)
(3, 2, 1, 1)
(3, 1, 1, 1, 1)
(2, 2, 2, 1)
(2, 2, 1, 1, 1)
(2, 1, 1, 1, 1, 1)
(1, 1, 1, 1, 1, 1, 1)

Return generator of positive integer tuples of length at least 1.

Changed in version 2.0: renamed mathtools.integer_partitions() to mathtools.yield_all_partitions_of_integer().

This Page