All pastes #802047 Raw Edit

Mine

public text v1 · immutable
#802047 ·published 2007-11-29 21:45 UTC
rendered paste body
 cheap-concurrency Ruby #2 program
 N  	Full CPU Time s 	Memory Use KB 	GZip Bytes
15,000 	66.70 	3,956 	149

#!/usr/bin/env ruby
#
# Gonzalo Garramuno -- Dec.31 2006
#

def coroutine(n)
  if n > 1
    coroutine(n-1) { |x| yield x + 1 }
  else
    yield 1 while true
  end
end

iter  = 0
last  = ARGV[0].to_i
count = 0

coroutine( 500 ) { |x|
  break if iter >= last
  count += x
  iter  += 1
}

puts count