PageRenderTime 25ms CodeModel.GetById 23ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/problem_02/problem_02.py

https://bitbucket.org/feinom/project-euler
Python | 15 lines | 11 code | 3 blank | 1 comment | 2 complexity | bc2cd4a4e99a7e6dd49c8d2fa527bd0a MD5 | raw file
 1#!/usr/bin/python
 2
 3a1 = 1
 4a2 = 2
 5an = 0
 6total = 0
 7while an < 4000000:
 8    an = a1 + a2
 9    if an % 2 == 0:
10        total += an
11    
12    a1 = a2
13    a2 = an
14
15print total + 2