This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

IntegerPartitions

IntegerPartitions[n]
gives a list of all possible ways to partition the integer n into smaller integers.
IntegerPartitions[n, k]
gives partitions into at most k integers.
IntegerPartitions[n, {k}]
gives partitions into exactly k integers.
IntegerPartitions[n, {kmin, kmax}]
gives partitions into between kmin and kmax integers.
IntegerPartitions[n, kspec, {s1, s2, ...}]
gives partitions involving only the si.
  • The si can be rational numbers, and can be negative.
  • n can be a rational number if the si are rational numbers.
  • In the list of partitions, those involving earlier si are given last.
New in 6