def fib(n) @fib_cache ||= [1, 1] @fib_cache[n] ||= fib(n-1) + fib(n-2) end puts fib(20)