4 5 6
# File 'lib/small/math.rb', line 4 def fact(n) (1..n).inject(1) {|r,i| r*i} end
9 10 11
# File 'lib/small/math.rb', line 9 def fib(n) n < 2 ? n : fib(n-1)+fib(n-2) end