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!

Why not?  You'd rather do that iteratively?  What kind of masochist are 
you? :D

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org
-- 
Posted via http://www.ruby-forum.com/.