21 lines
318 B
Python
21 lines
318 B
Python
|
import sys
|
||
|
sys.path.append("lib")
|
||
|
from num_fns import isDivBy
|
||
|
|
||
|
def fib(i):
|
||
|
if i == 1:
|
||
|
return 1
|
||
|
elif i == 2:
|
||
|
return 2
|
||
|
return fib(i - 1) + fib(i - 2)
|
||
|
|
||
|
sum = 0
|
||
|
|
||
|
for i in range(1, 1000000):
|
||
|
curr = fib(i)
|
||
|
if curr > 4000000:
|
||
|
break
|
||
|
if isDivBy(curr, 2): sum += curr
|
||
|
|
||
|
print(sum)
|