intPart {kStatistics} | R Documentation |
Integer partitions
Description
The function generates all possible (unique) decomposition of a positive integer n
in the
sum of positive integers less or equal to n
.
Usage
intPart(n=0 ,vOutput = FALSE)
Arguments
n |
integer |
vOutput |
optional boolean parameter, if equal to |
Details
A partition of an integer n
is a sequence of weakly increasing integers such
that their sum returns n
. The intPart
function generates all the partitions of a given integer
in increasing order.
Value
list |
all the partitions of |
Note
Called by the mkmSet
function in the kStatistics
package.
Author(s)
Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it
References
A. Nijenhuis, H. Wilf. (1978) Combinatorial Algorithms for Computers and Calculators. Academic Press, Orlando FL, II edition.
See Also
mkmSet
,
mCoeff
,
nStirling2
,
countP
,
ff
Examples
# 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)
# OR (same output)
intPart(4, FALSE)
# Return the same output as the previous example but in a compact expression
intPart(4, TRUE)