intPart | R Documentation |
The function generates all possible (unique) decomposition of a positive integer n
in the
sum of positive integers less or equal to n
.
intPart(n=0 ,vOutput = FALSE)
n |
integer |
vOutput |
optional boolean parameter, if equal to |
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.
list |
all the partitions of |
Called by the mkmSet
function in the kStatistics
package.
Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it
A. Nijenhuis, H. Wilf. (1978) Combinatorial Algorithms for Computers and Calculators. Academic Press, Orlando FL, II edition.
mkmSet
,
mCoeff
,
nStirling2
,
countP
,
ff
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.