def main(): goodLast = lambda n: pandigital(n % 10**9) goodFirst = lambda n: pandigital(n // 10**(numLen(n) - 9)) good = lambda n: n > 123456789 and goodLast(n) and goodFirst(n) return next(k for k, n in enumerate(fibonaccis()) if good(n))
def main(limit): return next(n for n, f in enumerate(fibonaccis()) if numLen(f) >= limit)
def main(): goodLast = lambda n: pandigital(n % 10 ** 9) goodFirst = lambda n: pandigital(n // 10 ** (numLen(n) - 9)) good = lambda n: n > 123456789 and goodLast(n) and goodFirst(n) return next(k for k, n in enumerate(fibonaccis()) if good(n))
def main(limit): # trick: n % 3 == 0 <=> fib(n) is even evenf = islice(fibonaccis(), 0, None, 3) return sum(takewhile(lambda n: n < limit, evenf))