裴波那契数列ruby实现 2014/11/08 15876 def fib n i = 2 a ,b = 1, 1 while i < n a,b = b, a+b i += 1 end b end p fib 16 #打印987