From: Mathieu Bouchard Date: 2001-03-11T03:15:40+09:00 Subject: [ruby-talk:12388] Re: ...and the challenge On Sat, 10 Mar 2001, GOTO Kentaro wrote: > >This takes 0.35 second here. > On my machine, yours takes 1.15 sec. > The following takes 0.55 sec here. Ok, I also had written the following one. How long does it take over there? it takes more time to initialize the ruby interpreter, and it takes more time to print the numbers than to generate them... nums=[] def foo(x,y,n); while y<=n; yield y; y *= x; end; end foo(2,1,n) {|a| foo(3,a,n) {|b| foo(5,b,n) {|c| nums << c }}} nums.sort! for x in nums do p x end (oh, btw. Ben's version takes over 3 times longer. i'm now testing with n=10**30 and using >/dev/null) matju