# Program to compute the first 100 numbers of the Fibonnaci series # Matt Bishop, Feb. 17, 2012 # for ECS 10 Winter 2012 fibdict = {} def fib(n): global fibdict if n in fibdict: return fibdict[n] if n == 0: fibdict[0] = 0 return 0 elif n == 1: fibdict[1] = 1 return 1 else: fibdict[n] = fib(n-1) + fib(n-2) return fibdict[n] def main(): # say how many numbers are to be printed count = 100 # compute the sequence and print the terms for i in range(count-2): # get next Fibonnaci number and # announce it print("Fibonnaci number", i+1, "is", fib(i)) main()