up previous next
number of partitions of an integer
NumPartitions(N: INT): INT |
This function returns the number of partitions of a non-negative integer,
i.e. the number of distinct ways of writing
N
as a sum of positive integers.
/**/ NumPartitions(2); -- 2 and 1+1
2
/**/ NumPartitions(5);
7
|