Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > d92aa75c2d384ff9f513aed09a46f703 > files > 473

parrot-doc-3.1.0-2.mga1.i586.rpm

#! ruby
#
# this algorithm is so dumb!
# it even hurts to write this equivalent to fib.pl

def fib(n)
	return n if (n < 2)
	return fib(n - 1) + fib(n - 2)
end

N = Integer( ARGV.shift || 28 )

puts "fib(#{N}) = #{ fib(N) }"