get.partitions | R Documentation |
This function solves the problem of additive partitioning of positive integers. The approach for additive partitioning is based on a generating function discussed in details in Voinov and Nikulin (1995). The function enumerates all partitions of a positive integer n
on at most (or exactly) M
parts, M <= n
.
get.partitions(n, M, at.most=TRUE)
n |
A positive integer to be partitioned. |
M |
A positive integer, the number of parts of |
at.most |
If |
p.n |
total number of partitions obtained. |
partitions |
a matrix with each column presenting partitions of |
Vassilly Voinov, Natalya Pya Arnqvist, Yevgeniy Voinov
Voinov, V. and Nikulin, M. (1995) Generating functions, problems of additive number theory, and some statistical applications. Revue Roumaine de Mathématiques Pures et Appliquées, 40(2), 107-147
Voinov, V.G. and Pya, N.E. (2017) R-software for additive partitioning of positive integers. Mathematical Journal (ISSN 1682-0525) 17(1), 69-76.
nilde-package
, get.knapsack
, get.subsetsum
, nlde
## getting all partitions of n = 8 on at most 6 parts... get.partitions(8,6,at.most=TRUE) ## getting all partitions of n = 8 on exactly 6 parts... b <- get.partitions(8,6,at.most=FALSE) b colSums(b$partitions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.