get.partitions function

Additive partitioning of natural numbers

Additive partitioning of natural numbers

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)

Arguments

  • n: A positive integer to be partitioned.
  • M: A positive integer, the number of parts of n, M <= n.
  • at.most: If TRUE then partitioning of n into at most M parts, if FALSE then partitioning on exactly M parts.

Returns

  • p.n: total number of partitions obtained.

  • partitions: a matrix with each column presenting partitions of n.

Author(s)

Vassilly Voinov, Natalya Pya Arnqvist, Yevgeniy Voinov

References

Voinov, V. and Nikulin, M. (1995) Generating functions, problems of additive number theory, and some statistical applications. Revue Roumaine de Pures et , 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.

See Also

nilde-package, get.knapsack, get.subsetsum, nlde

Examples

## 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)
  • Maintainer: Natalya Pya Arnqvist
  • License: GPL (>= 2)
  • Last published: 2022-08-16

Useful links