Forum: Ruby Help on algorythm

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D82e1620b63912765315e87da27e7ae3?d=identicon&s=25 Helder Oliveira (kaydara)
on 2008-12-09 15:51
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 :)
9d4960f8319664f0f7896230eebace73?d=identicon&s=25 Glen Holcomb (Guest)
on 2008-12-09 16:04
(Received via mailing list)
On Tue, Dec 9, 2008 at 7:44 AM, Helder Oliveira
<hrpoliveira@gmail.com>wrote:

>
> Need a little help with this guys :)
>
>
> Note: this is not for a school work or project :)
> --
> Posted via http://www.ruby-forum.com/.
>
>
http://www.google.com/search?hl=en&q=Ruby+permutat...

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2008-12-09 16:16
(Received via mailing list)
On Tue, Dec 9, 2008 at 9:56 AM, Glen Holcomb <damnbigman@gmail.com>
wrote:

> http://www.google.com/search?hl=en&q=Ruby+permutat...

Oh come on, we can do better than that:
http://tinyurl.com/57769d

---
Technical Blaag at: http://blog.majesticseacreature.com
 Non-tech stuff at: http://metametta.blogspot.com
"Ruby Best Practices"  Book now in O'Reilly Roughcuts:
http://rubybestpractices.com
D82e1620b63912765315e87da27e7ae3?d=identicon&s=25 Helder Oliveira (kaydara)
on 2008-12-09 16:19
ok ok,
sorry guys for the question, and thanks for the replys ;)
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2008-12-09 16:24
(Received via mailing list)
On Tue, Dec 9, 2008 at 4:08 PM, Gregory Brown
<gregory.t.brown@gmail.com> wrote:
> On Tue, Dec 9, 2008 at 9:56 AM, Glen Holcomb <damnbigman@gmail.com> wrote:
>
>> http://www.google.com/search?hl=en&q=Ruby+permutat...
>
> Oh come on, we can do better than that:
> http://tinyurl.com/57769d
and who is going to click on the links for me? Read the stuff? and
explain it to me?
A8486651a974d7d9ecc35d25de96c7ee?d=identicon&s=25 Chris Lowis (chrislo)
on 2008-12-09 16:31
Gregory Brown wrote:
> Oh come on, we can do better than that:
> http://tinyurl.com/57769d

Of course, this assumes that one knows the meaning of the English word
Permutations. I'm not sure if this was the case or not with the original
poster, perhaps he wasn't simply being lazy :) !

Chris
Bb6ecee0238ef2461bef3416722b35c5?d=identicon&s=25 pat eyler (Guest)
on 2008-12-09 16:39
(Received via mailing list)
On Tue, Dec 9, 2008 at 8:08 AM, Gregory Brown
<gregory.t.brown@gmail.com> wrote:
> On Tue, Dec 9, 2008 at 9:56 AM, Glen Holcomb <damnbigman@gmail.com> wrote:
>
>> http://www.google.com/search?hl=en&q=Ruby+permutat...
>
> Oh come on, we can do better than that:
> http://tinyurl.com/57769d

Gregory, I can't believe you'd use some url shortener of questionable
language choices, surely http://rubyurl.com/ltJs is a better option.
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2008-12-09 16:42
(Received via mailing list)
On Tue, Dec 9, 2008 at 4:24 PM, Chris Lowis <chris.lowis@gmail.com>
wrote:
> Gregory Brown wrote:
>> Oh come on, we can do better than that:
>> http://tinyurl.com/57769d
>
> Of course, this assumes that one knows the meaning of the English word
> Permutations. I'm not sure if this was the case or not with the original
> poster, perhaps he wasn't simply being lazy :) !
Oh he did not ask for permutations, he asked for combinations, are we
being unfriendly?
R.

--
Il computer non è una macchina intelligente che aiuta le persone
stupide, anzi, è una macchina stupida che funziona solo nelle mani
delle persone intelligenti.
Computers are not smart to help stupid people, rather they are stupid
and will work only if taken care of by smart people.

Umberto Eco
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2008-12-09 16:45
(Received via mailing list)
On Dec 9, 2008, at 9:29 AM, pat eyler wrote:

> Gregory, I can't believe you'd use some url shortener of questionable
> language choices, surely http://rubyurl.com/ltJs is a better option.

The hilarious site Greg used has the other option built-in.  :(  We
should lobby them for RubyURL support.

James Edward Gray II
9d4960f8319664f0f7896230eebace73?d=identicon&s=25 Glen Holcomb (Guest)
on 2008-12-09 16:50
(Received via mailing list)
On Tue, Dec 9, 2008 at 8:33 AM, Robert Dober <robert.dober@gmail.com>
wrote:

> R.
>
>
Good point he didn't specifically state that position mattered and did
actually say combination, oh well my bad ;)

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
851acbab08553d1f7aa3eecad17f6aa9?d=identicon&s=25 Ken Bloom (Guest)
on 2008-12-09 18:40
(Received via mailing list)
On Tue, 09 Dec 2008 09:44:23 -0500, Helder Oliveira wrote:

>
> 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
A8486651a974d7d9ecc35d25de96c7ee?d=identicon&s=25 Chris Lowis (chrislo)
on 2008-12-09 18:41
> Oh he did not ask for permutations, he asked for combinations, are we
> being unfriendly?

No, not at all. I was simply making the observation that selecting the
correct (often English due to the availability of material in that
language) word can open a goldmine of results in Google searches.
Sometimes all one can do is explain a concept, because one doesn't have
the vocabulary to reduce it to a single, searchable word.

At least, that's been my experience with the non-native languages I
speak poorly, and I'm counting mathematics as one of those languages
here!

Chris
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2008-12-09 20:31
(Received via mailing list)
On Tue, Dec 9, 2008 at 6:34 PM, Chris Lowis <chris.lowis@gmail.com>
wrote:

Ai ges U R rite ;).
Indeed I think you made a good point.
R.
This topic is locked and can not be replied to.