# nlde: Enumeration of all existing nonnegative integer solutions of... In nilde: Nonnegative Integer Solutions of Linear Diophantine Equations with Applications

## Description

This function enumerates nonnegative integer solutions of a linear Diophantine equation (NLDE):

a_1s_1 +a_2s_2 +...+ a_ls_l =n,

where a_1 <= a_2 <= ... <= a_l, a_i > 0, n > 0, s_i >= 0, i=1,2,...,l, and all variables involved are integers.

The algorithm is based on a generating function of Hardy and Littlewood used by Voinov and Nikulin (1997).

## Usage

 1 nlde(a, n, M=NULL, at.most=TRUE, option=0)

## Arguments

 a An l-vector of positive integers (coefficients of the left-hand-side of NLDE) with l>= 2. n A positive integer which is to be partitioned. M A positive integer, the number of parts of n, M <= n. at.most If TRUE partitioning of n into at most M parts, if FALSE partitioning on exactly M parts. option When set to 1 (or any positive number) finds only 0-1 solutions of the linear Diophantine equation. When set to 2 (or any positive number > 1) finds 0-1 solutions of the linear Diophantine inequality.

## Value

 p.n total number of partitions obtained. solutions a matrix with each column forming a partition of n.

## Author(s)

Vassilly Voinov, Natalya Pya Arnqvist, Yevgeniy Voinov

## References

Voinov, V. and Nikulin, M. (1997) On a subset sum algorithm and its probabilistic and other applications. In: Advances in combinatorial methods and applications to probability and statistics, Ed. N. Balakrishnan, BirkhĂ¤user, Boston, 153-163.

Hardy, G.H. and Littlewood, J.E. (1966) Collected Papers of G.H. Hardy, Including Joint Papers with J.E. Littlewood and Others. Clarendon Press, Oxford.