Wow. It’s been a longtime since I’ve made a post here. Let’s just say… life has been hectic.

I’ve been spending some time with Python and web scraping. It’s been a whole bunch of fun. There’s no better feeling than setting up a script to crawl your favourite website and dumping hundreds of pictures. All at the click of a button.

The programming got me itching to try and solve some math-based problems (something a little more challenging). Get my old mind turning. I thought I’d dust off some of my project euler work. Here’s an interesting one…

Even Fibonacci Numbers

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Here goes nothing:

<pre class="wp-block-syntaxhighlighter-code wp-block-code">
n1 = 1
n2 = 2
sumTotal = 0

def is_even(n):
if (n%2) == 0:
  return True
  return False

while n2 &amp;lt; 4000000:
  if is_even(n2):
    sumTotal = sumTotal + n2
  n2 = n1 + n2
  n1 = n2 - n1


Now, that was fun. Time for bed!