/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. a1 = 1
  3. a2 = 2
  4. an = 0
  5. total = 0
  6. while an < 4000000:
  7. an = a1 + a2
  8. if an % 2 == 0:
  9. total += an
  10. a1 = a2
  11. a2 = an
  12. print total + 2