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.
Not super looking forward to this one because series were my worst Math subject. But hey, let’s give it a go. Fibonacci sequences are characterized by the fact that every number after the first two is the sum of the two preceding ones. Which can lead to some very simple (like the one I’ll use) to super complex formulas. Let’s write some pseudocode!
Include some stuff Define some stuff if we can’t inline it Going to need a loop Going to need a Fibonacci sequence generator (can make one or use an existing one? Maybe both?) Going to need to test for “evenness” Going to need to sum it