diff --git a/lib/__pycache__/num_fns.cpython-310.pyc b/lib/__pycache__/num_fns.cpython-310.pyc new file mode 100644 index 0000000..e058596 Binary files /dev/null and b/lib/__pycache__/num_fns.cpython-310.pyc differ diff --git a/lib/num_functions.py b/lib/num_fns.py similarity index 100% rename from lib/num_functions.py rename to lib/num_fns.py diff --git a/src/problem1.py b/src/problem1.py index feeea44..0ba8107 100755 --- a/src/problem1.py +++ b/src/problem1.py @@ -1,6 +1,6 @@ import sys sys.path.append("lib") -from num_functions import isDivBy +from num_fns import isDivBy sum = 0 diff --git a/src/problem2.py b/src/problem2.py new file mode 100644 index 0000000..97c41a9 --- /dev/null +++ b/src/problem2.py @@ -0,0 +1,20 @@ +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)