From: Christian Neukirchen Date: 2007-02-01T06:12:36+09:00 Subject: Re: Counting Toothpicks (#111) "George Ogata" writes: >> class Fixnum >> def divisors >> @d ||= (2..self/2).select{|i| self % i == 0 } > > You've probably already realized this, but this would be a lot faster: > > @d ||= (2..Math.sqrt(self)).select{|i| self % i == 0 } > >> end >> end You reminded me of http://butunclebob.com/ArticleS.UncleBob.PerformanceTuning -- Christian Neukirchen http://chneukirchen.org