IntegerPartitions
IntegerPartitions[n]
lists the possible ways to partition n
into smaller integers.
IntegerPartitions[n, k]
lists the possible ways to partition n
into smaller integers, using up to k
elements.
Attributes[IntegerPartitions] := {Protected}
Simple examples
Find the partitions of 4:
Find the partitions of 10, using a maximum of k = 2 integers:Further examples
The partitions of zero is a nested empty List: