Wednesday, September 19, 2007

Project Euler

Solution to Problem #2. Still a brute-force approach. The next one won't be so straightforward. Damn that one-minute requirement!



# Project Euler, Problem #2
#
# Find the sum of all even-valued terms
# in the Fibonacci sequence which do not
# exceed one million.

n1, n2 = 1, 2
sum = 0

while n1 < 2 ="="" sum =" sum" n2 =" n2,">

1 comment:

Steve said...

I'm not holding myself to the one-minute rule too faithfully, but I try to re-engineer to get under the mark when I can. I still need to polish my algorithms for #4, #9, #10 and #14 that went overtime, the most egregious taking over nine minutes on my antiquated hardware.