Sum of Even Fibonacci Sequence

By starting Fibonacci 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.

Excellent problem. My second take at Euler’s Project. Although it is the second easiest (possibly) problem in the website, my bragging right that I solved this problem in less than 10 minutes remains.

`def fib(max) n1, n2, n = 1, 2, 0 arr = [n1, n2] while n < max  n = n1 + n2  n1, n2 = n2, n   arr << n  end arr_sum = arr[0..-2].reject {|e| e % 2 != 0}.reduce(:+)end`
`fib(4000000)`

Without looking at wikipedia, Fibonacci number is an accumulation of numbers consisted of the sum of the previous two numbers. If a Fibonacci sequence starts with 0 and 1, then the sequence goes 0, 1, (0+1), (1+(0+1)),((0+1)+(1+(0+1))), and so on. They seem to appear everywhere, from hurricanes to galaxies to pineapples.

What other Fibonacci patterns do you recognize are around you?

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.