You are viewing a single comment's thread. Return to all comments →
#!/bin/python3 import sys def F(n): phi = (1 + 5**0.5)/2 return round((phi**n-(-phi)**(-n))/5**0.5) t = int(input().strip()) for a0 in range(t): num = int(input().strip()) n = 0 F3n = 0 s = 0 while F3n <= num: s += F3n F3n = 5*F(n)**3 + 3*(-1)**n*F(n) n += 1 print(s)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #2: Even Fibonacci numbers
You are viewing a single comment's thread. Return to all comments →
Python