Integer partition (SymPy, WMA)
IntegerPartitions
[n]IntegerPartitions
[n, k]IntegerPartitions
[n, {k}]IntegerPartitions
[n, {$k_{min}$, $k_{max}$}]IntegerPartitions
[n, kspec, {$s_1$, $s_2$, ...}]All partitions of positive integers that add to 5:
IntegerPartitions[5]
Limit the above to just the first 3 elements:
IntegerPartitions[5, All, All, 3]
Partitions of 5 with at most 3 integers:
IntegerPartitions[5, 3]
Partitions of 5 with exactly 3 integers; this is a subset of “at most 3” above:
IntegerPartitions[5, {3}]
Partitions of 5 that involve only integers 1, and 2:
IntegerPartitions[5, All, {1, 2}]
Partitions of 4 with exactly 2 elements and involve only integers -1, 0, 1, 4, and 5:
IntegerPartitions[4, {2}, {-1, 0, 1, 4, 5}]