def lenth_of_fib(length): index = 1 while True: val = solutions.fib(index) if len(str(val)) == length: return val index += 1
def first_fib_limit(limit): """ >>> first_fib_limit(100) 476 >>> first_fib_limit(3) 12 >>> first_fib_limit(1) 1 """ cached = {} index = 1 while True: val = solutions.fib(index, cached) if len(str(val)) == limit: return index cached[index] = val index += 1