import time time.clock() def search(limit, count): l = [1, 1] tale = 0 while len(l) < count + 2: tale += len(list(filter(lambda x: x > limit - 1, l))) l = list(map(lambda x: x[0] + x[1], zip(l + [0], [0] + l))) return tale print(search(1000000, 100)) print(time.clock())