From: Aldric Giacomoni Date: 2009-11-26T02:11:53+09:00 Subject: Re: Ruby internals & other questions Ralph Shnelvar wrote: >>> >>> (2) What's the best Ruby way to do a sum from 1 to 1_000_000 > > MLK> Gauss's method: > MLK> def triangular(n) > MLK> (n + 1) * n / 2 > MLK> end > > Ugh ... you _know_ that is not what I meant! Ralph, you do have to be careful. I got yelled at for answering the questions you _meant_ to ask because they weren't the answers to the questions you _did_ ask ;) -- Posted via http://www.ruby-forum.com/.