Rebased projecteuler folder, now includes all contest programming stuff
This commit is contained in:
21
projecteuler/002/main.py
Normal file
21
projecteuler/002/main.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
|
||||
|
||||
# Find the sum of all Fibonacci numbers below four million
|
||||
|
||||
|
||||
s = 0
|
||||
|
||||
n = 1
|
||||
m = 1
|
||||
|
||||
while m < 4000000:
|
||||
temp = m
|
||||
m = n + temp
|
||||
n = temp
|
||||
|
||||
if m % 2 == 0:
|
||||
s = s + m
|
||||
|
||||
print(s)
|
||||
Reference in New Issue
Block a user