Maxima Function
num_partitions (n)
num_partitions(n,list)
Returns the number of integer partitions of n
when n is a nonnegative integer.
Otherwise, num_partitions
returns a noun expression.
num_partitions(n, list)
returns a
list of the number of integer partitions of 1, 2, 3, ..., n.
For a nonnegative integer n, num_partitions(n)
is equal to
cardinality(integer_partitions(n))
; however, num_partitions
does not actually construct the set of partitions, so it is much faster.
Examples:
(%i1) num_partitions (5) = cardinality (integer_partitions (5)); (%o1) 7 = 7 (%i2) num_partitions (8, list); (%o2) [1, 1, 2, 3, 5, 7, 11, 15, 22] (%i3) num_partitions (n); (%o3) num_partitions(n)