combinat::partitions --
n-th partitions number
Introductioncombinat::partitions(n) returns the number
of partitions of the nonnegative integer n.
Call(s)combinat::partitions(n)
Parametersn |
- | a nonnegative integer |
ReturnsThe number of partitions as a positive integer.
Detailsn
is the number of representations of n as n = n_1 +
... + n_k, n_i >= 1, i=1..k. By definition
combinat::partitions(0) is 1.n Euler's pentagonal formula is used to
compute combinat::partitions(n).
p(n) + sum((-1)^k*(p(n-w(k)) + p(n-w(-k))), k = 1..infinity) = 0, where w(k) = (3*k^2 + k)/2
For large n the Hardy-Ramanujan-Rademacher formula is
used.
Example
1We can write 3 in 3 different ways as a sum of nonnegative integers. They are 3=1+1+1=1+2=3.
>> combinat::partitions(3)
3
Example
2The number of partitions of n grows very rapidly for larger n.
>> combinat::partitions(111)
679903203
Example
3A negative number cannot be written as a sum of positive integers.
>> combinat::partitions(-3)
Error: Argument must be a nonnegative integer [combinat::parti\
tions]
Further
DocumentationG. Andrews, The Theory of Partitions, Addison-Wesley, 1976