def euler_65(): """Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e.""" from eutil import nth, digits def sequence(): num = [] t = 0 while True: if t == 0: num.append(1) elif t == 1: num.append(2) else: coef = t / 3 * 2 if t % 3 == 0 else 1 num.append(coef * num[t - 1] + num[t - 2]) yield num[-1] t += 1 return sum(digits(nth(sequence(), 100)))
def euler_7(): """Find the 10001st prime.""" from eutil import primes, nth return nth(primes(), 10000)
def euler_24(): """What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?""" from itertools import permutations from eutil import nth return "".join(map(str, nth(permutations(range(10), 10), 999999)))