Exemplo n.º 1
0
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))
Exemplo n.º 2
0
def main(limit):
	return next(n for n, f in enumerate(fibonaccis()) if numLen(f) >= limit)
Exemplo n.º 3
0
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))
Exemplo n.º 4
0
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))
Exemplo n.º 5
0
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))