"There's a lot to learn about the [Fibonacci numbers](https://en.wikipedia.org/wiki/Fibonacci_sequence), and this will not be the last time we see them in a Project Euler problem, but for now this problem keeps it relatively simple.\n",
"\n",
"Since this is a SageMath notebook, we'll use its functionality so we can keep our code simple like the problem."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "57b68465",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4613732"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum(n for n in fibonacci_xrange(1, 4000000) if n % 2 == 0)"
]
},
{
"cell_type": "markdown",
"id": "eef788da",
"metadata": {},
"source": [
"Even without SageMath, it's easy to implement our own generator of the sequence up to $n$."
"* Partial sums of even Fibonacci numbers: [A099919](https://oeis.org/A099919)\n",
"\n",
"#### Copyright (C) 2025 filifa\n",
"\n",
"This work is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International license](https://creativecommons.org/licenses/by-sa/4.0/) and the [BSD Zero Clause license](https://spdx.org/licenses/0BSD.html)."