[R] Same sum, different sets of integers

Atte Tenkanen attenka at utu.fi
Wed Apr 27 17:46:44 CEST 2016


Hi,

Do you have ideas, how to find all those different combinations of 
integers (>0) that produce as a sum, a certain integer.

i.e.: if that sum is

3, the possibilities are c(1,1,1), c(1,2), c(2,1)
4, the possibilities are 
c(1,1,1,1),c(1,1,2),c(1,2,1),c(2,1,1),c(2,2),c(1,3),c(3,1)

etc.

Best regards,

Atte Tenkanen



More information about the R-help mailing list