From 6d6ae816ebc13080078c158d11e27a47e9222e5c Mon Sep 17 00:00:00 2001 From: MitchellHansen Date: Thu, 21 Jan 2016 23:46:58 -0800 Subject: [PATCH] Initial commit Changes to be committed: new file: problem_1.py new file: problem_2.py new file: problem_3.py --- problem_1.py | 13 +++++++++++++ problem_2.py | 19 +++++++++++++++++++ problem_3.py | 0 3 files changed, 32 insertions(+) create mode 100644 problem_1.py create mode 100644 problem_2.py create mode 100644 problem_3.py diff --git a/problem_1.py b/problem_1.py new file mode 100644 index 0000000..7b2af50 --- /dev/null +++ b/problem_1.py @@ -0,0 +1,13 @@ +import math + + +sum = 0 + + +for x in range(0, 1000): + if x % 3 == 0: + sum += x + elif x % 5 == 0: + sum += x + +print(sum) diff --git a/problem_2.py b/problem_2.py new file mode 100644 index 0000000..abbc9dc --- /dev/null +++ b/problem_2.py @@ -0,0 +1,19 @@ + +prev_two = 1; +prev_one = 0; +fib_num = 0 +sum = 0 + +while True: + if fib_num > 4000000: + break + + fib_num = prev_one + prev_two + + if fib_num % 2 == 0: + sum += fib_num + + prev_two = prev_one + prev_one = fib_num + +print(sum) diff --git a/problem_3.py b/problem_3.py new file mode 100644 index 0000000..e69de29