[1] 4613732
Problem 2 - Even Fibonacci Numbers
Sri Lanka
Fibonacci
divisors
remainder
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, \dots\]
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
https://projecteuler.net/problem=2
Thoughts
This is straightforward. We can calculate the Fibonacci sequence up to the value of 4 million. Then, we can sum all even numbers in the sequence.
R
Answer 1
Python
Answer 1
Code
x = [1,2]
while x[-1] < 4e6:
x.append(sum(x[-2:]))
sum([i for i in x if i % 2 == 0])4613732
Reuse
© 2023-2026 Vincent Clemson | This post is licensed under <a href='http://creativecommons.org/licenses/by-nc-sa/4.0/' target='_blank'>CC BY-NC-SA 4.0</a>
Citation
For attribution, please cite this work as:
Clemson, Vincent. 2026. “Problem 2 - Even Fibonacci
Numbers.” January 15, 2026. https://prncevince.xyz/euler/problem/0002/.
