Generate all possible (unique) ways to represent a positive integer n as sum of positive integers.
Usage
intPart(n)
Arguments
n
integer
Value
list
all partitions of n
Details
A partition of an integer n is a sequence of weakly increasing integers such that their sum returns n.
The function generates all the partitions of a given integer
in sorted order.
References
Nijenhuis A. and Wilf. H., Combinatorial Algorithms for Computers and Calculators. Academic Press, Orlando FL, II edition,
1978.
# NOT RUN {# Return the partition of the integer 3, that is # [1,1,1],[1,2],[3]intPart(3)
# Return the partition of the integer 4, that is # [1,1,1,1],[1,1,2],[1,3],[2,2],[4]intPart(4)
# }