def eul25(): """What is the index of the first term in the Fibonacci sequence to contain 1000 digits?""" index, a, b = 1, 0, 1 while eul.num_len(b) < 1000: a, b = b, a + b index += 1 return index
def eul57(): """In the first one-thousand expansions, how many fractions contain a numerator with more digits than denominator?""" count = 0 for i in range(1, 1001): num = 1 den = 2 for j in range(i-1, 0, -1): num += 2 * den tmp = den den = num num = tmp num += den if eul.num_len(num) > eul.num_len(den): count += 1 return count