# [R] Optimal Code for subset of Integer Sets

Tue Jul 26 23:38:52 CEST 2011

If I understand you correctly, you are looking for partitions of an integer, so look at Robin Hankin's package 'partitions'

David L. Reiner

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of David Pham
Sent: Tuesday, July 26, 2011 5:14 AM
To: r-help at r-project.org
Subject: [R] Optimal Code for subset of Integer Sets

Hi,

I wanted to know if there existed an good implementation in R of the following classical subset Integers  :

$P_{n,m} = {k_1, \ldots, k_m \in \mathbb{N} : k_1 + \ldots + k_m = n }$

for any integers $m < n$. There is an obvious not optimal code which would be to run through $m$ sums and put a boolean condition to report if the integers respect these condition but it would take $m^n$ steps...

David Pham

[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help