An algorithm for generating such partitions was published in JRSS C (Applied
Statistics) in 1997:
@Article{Garcia-Perez:1997:DIA,
author = "M. A. Garcia-Perez",
title = "{AS 320}: Decomposing an integer {$N$} into all sets
of {$J$} positive integer summands by simulation of
dynamically varying nested {DO} loops",
journal = j-APPL-STAT,
volume = "46",
number = "4",
pages = "522--??",
month = "????",
year = "1997",
CODEN = "APSTAG",
ISSN = "0035-9254",
bibdate = "Sat Jan 2 15:12:05 MST 1999",
acknowledgement = ack-nhfb,
}
This algorithm is quite similar to that implemented in function xsimplex in the
combinat library section/package, although xsimplex solves a related but
different problem.
You also can find pseudo-code for this problem in some combinatorics books such
as "Combinatorial Algorithms" by Reingold, Nievergelt, and Deo.
Cheers,
Scott
Scott Chasalow
Statistical Genetics & Biomarkers
Bristol-Myers Squibb
> Dear users
>
> Is there a general algorithm for finding all sets of say k +ve integers that
> sum
> to S. For example, say I need all sets of 3 positve integers that sum to 6 :
> (1,2,3), (1,1,4), (2,2,2).
>
> Thanks
>
> rhoderick
|