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.

IntegerPartitions[n,kspec,sspec,m]

limits the result to the first m partitions.

Details

Examples

open allclose all

Basic Examples  (1)

All partitions of 5:

In[1]:=
Click for copyable input
Out[1]=

Scope  (3)

Generalizations & Extensions  (4)

Applications  (2)

Properties & Relations  (4)

Possible Issues  (3)

See Also

PartitionsP  Divisors  Subsets  IntegerDigits  NumberDecompose  FrobeniusSolve  PowersRepresentations

Tutorials

Introduced in 2007
(6.0)
| Updated in 2008
(7.0)