From: Ken Bloom Date: 2008-12-10T02:33:25+09:00 Subject: Re: Help on algorythm On Tue, 09 Dec 2008 09:44:23 -0500, Helder Oliveira wrote: > Guys i have been trying to make this algorythm but with no sucess, can > you help me out ? > > The problem is the follow > > for the following numberset like 1,2,3,4,5,6,7,8,9,10,11,12 i need to > take all the five number combinations, six number combinations and the > seven number combinations, this cant be "hardcoded", this need to be > flexible because at any time i may need all the 3 number combinations > and later i may need numbersets of 15 or even more. > > Need a little help with this guys :) > > > Note: this is not for a school work or project :) In Ruby 1.8.7 numberset=(1..12).to_a (5..7).each do |combination_size| numberset.combination(combination_size).do_something_with_it end -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/