Cody

Problem 232. Project Euler: Problem 2, Sum of even Fibonacci

Solution 1974908

Submitted on 14 Oct 2019 by Joseph Chambers
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x =4000000 y_correct = 4613732; assert(isequal(euler002(x),y_correct))

x = 4000000 fibonacci = 1 1 1 1 1 1 1 1 1 fibonacciA = 1 fibonacciB = 2 fibonacciC = 3 i = 3 sumEven = 2 fibonacciC = 3 fibonacciA = 2 fibonacciB = 3 fibonacciC = 5 fibonacciA = 3 fibonacciB = 5 fibonacciC = 8 sumEven = 10 fibonacciA = 5 fibonacciB = 8 fibonacciC = 13 fibonacciA = 8 fibonacciB = 13 fibonacciC = 21 fibonacciA = 13 fibonacciB = 21 fibonacciC = 34 sumEven = 44 fibonacciA = 21 fibonacciB = 34 fibonacciC = 55 fibonacciA = 34 fibonacciB = 55 fibonacciC = 89 fibonacciA = 55 fibonacciB = 89 fibonacciC = 144 sumEven = 188 fibonacciA = 89 fibonacciB = 144 fibonacciC = 233 fibonacciA = 144 fibonacciB = 233 fibonacciC = 377 fibonacciA = 233 fibonacciB = 377 fibonacciC = 610 sumEven = 798 fibonacciA = 377 fibonacciB = 610 fibonacciC = 987 fibonacciA = 610 fibonacciB = 987 fibonacciC = 1597 fibonacciA = 987 fibonacciB = 1597 fibonacciC = 2584 sumEven = 3382 fibonacciA = 1597 fibonacciB = 2584 fibonacciC = 4181 fibonacciA = 2584 fibonacciB = 4181 fibonacciC = 6765 fibonacciA = 4181 fibonacciB = 6765 fibonacciC = 10946 sumEven = 14328 fibonacciA = 6765 fibonacciB = 10946 fibonacciC = 17711 fibonacciA = 10946 fibonacciB = 17711 fibonacciC = 28657 fibonacciA = 17711 fibonacciB = 28657 fibonacciC = 46368 sumEven = 60696 fibonacciA = 28657 fibonacciB = 46368 fibonacciC = 75025 fibonacciA = 46368 fibonacciB = 75025 fibonacciC = 121393 fibonacciA = 75025 fibonacciB = 121393 fibonacciC = 196418 sumEven = 257114 fibonacciA = 121393 fibonacciB = 196418 fibonacciC = 317811 fibonacciA = 196418 fibonacciB = 317811 fibonacciC = 514229 fibonacciA = 317811 fibonacciB = 514229 fibonacciC = 832040 sumEven = 1089154 fibonacciA = 514229 fibonacciB = 832040 fibonacciC = 1346269 fibonacciA = 832040 fibonacciB = 1346269 fibonacciC = 2178309 fibonacciA = 1346269 fibonacciB = 2178309 fibonacciC = 3524578 sumEven = 4613732 fibonacciA = 2178309 fibonacciB = 3524578 fibonacciC = 5702887 y = 4613732

2   Pass
x =97455000 y_correct = 82790070; assert(isequal(euler002(x),y_correct))

x = 97455000 fibonacci = 1 1 1 1 1 1 1 1 1 fibonacciA = 1 fibonacciB = 2 fibonacciC = 3 i = 3 sumEven = 2 fibonacciC = 3 fibonacciA = 2 fibonacciB = 3 fibonacciC = 5 fibonacciA = 3 fibonacciB = 5 fibonacciC = 8 sumEven = 10 fibonacciA = 5 fibonacciB = 8 fibonacciC = 13 fibonacciA = 8 fibonacciB = 13 fibonacciC = 21 fibonacciA = 13 fibonacciB = 21 fibonacciC = 34 sumEven = 44 fibonacciA = 21 fibonacciB = 34 fibonacciC = 55 fibonacciA = 34 fibonacciB = 55 fibonacciC = 89 fibonacciA = 55 fibonacciB = 89 fibonacciC = 144 sumEven = 188 fibonacciA = 89 fibonacciB = 144 fibonacciC = 233 fibonacciA = 144 fibonacciB = 233 fibonacciC = 377 fibonacciA = 233 fibonacciB = 377 fibonacciC = 610 sumEven = 798 fibonacciA = 377 fibonacciB = 610 fibonacciC = 987 fibonacciA = 610 fibonacciB = 987 fibonacciC = 1597 fibonacciA = 987 fibonacciB = 1597 fibonacciC = 2584 sumEven = 3382 fibonacciA = 1597 fibonacciB = 2584 fibonacciC = 4181 fibonacciA = 2584 fibonacciB = 4181 fibonacciC = 6765 fibonacciA = 4181 fibonacciB = 6765 fibonacciC = 10946 sumEven = 14328 fibonacciA = 6765 fibonacciB = 10946 fibonacciC = 17711 fibonacciA = 10946 fibonacciB = 17711 fibonacciC = 28657 fibonacciA = 17711 fibonacciB = 28657 fibonacciC = 46368 sumEven = 60696 fibonacciA = 28657 fibonacciB = 46368 fibonacciC = 75025 fibonacciA = 46368 fibonacciB = 75025 fibonacciC = 121393 fibonacciA = 75025 fibonacciB = 121393 fibonacciC = 196418 sumEven = 257114 fibonacciA = 121393 fibonacciB = 196418 fibonacciC = 317811 fibonacciA = 196418 fibonacciB = 317811 fibonacciC = 514229 fibonacciA = 317811 fibonacciB = 514229 fibonacciC = 832040 sumEven = 1089154 fibonacciA = 514229 fibonacciB = 832040 fibonacciC = 1346269 fibonacciA = 832040 fibonacciB = 1346269 fibonacciC = 2178309 fibonacciA = 1346269 fibonacciB = 2178309 fibonacciC = 3524578 sumEven = 4613732 fibonacciA = 2178309 fibonacciB = 3524578 fibonacciC = 5702887 fibonacciA = 3524578 fibonacciB = 5702887 fibonacciC = 9227465 fibonacciA = 5702887 fibonacciB = 9227465 fibonacciC = 14930352 sumEven = 19544084 fibonacciA = 9227465 fibonacciB = 14930352 fibonacciC = 24157817 fibonacciA = 14930352 fibonacciB = 24157817 fibonacciC = 39088169 fibonacciA = 24157817 fibonacciB = 39088169 fibonacciC = 63245986 sumEven = 82790070 fibonacciA = 39088169 fibonacciB = 63245986 fibonacciC = 102334155 y = 82790070

3   Pass
x =597455000 y_correct = 350704366; assert(isequal(euler002(x),y_correct))

x = 597455000 fibonacci = 1 1 1 1 1 1 1 1 1 fibonacciA = 1 fibonacciB = 2 fibonacciC = 3 i = 3 sumEven = 2 fibonacciC = 3 fibonacciA = 2 fibonacciB = 3 fibonacciC = 5 fibonacciA = 3 fibonacciB = 5 fibonacciC = 8 sumEven = 10 fibonacciA = 5 fibonacciB = 8 fibonacciC = 13 fibonacciA = 8 fibonacciB = 13 fibonacciC = 21 fibonacciA = 13 fibonacciB = 21 fibonacciC = 34 sumEven = 44 fibonacciA = 21 fibonacciB = 34 fibonacciC = 55 fibonacciA = 34 fibonacciB = 55 fibonacciC = 89 fibonacciA = 55 fibonacciB = 89 fibonacciC = 144 sumEven = 188 fibonacciA = 89 fibonacciB = 144 fibonacciC = 233 fibonacciA = 144 fibonacciB = 233 fibonacciC = 377 fibonacciA = 233 fibonacciB = 377 fibonacciC = 610 sumEven = 798 fibonacciA = 377 fibonacciB = 610 fibonacciC = 987 fibonacciA = 610 fibonacciB = 987 fibonacciC = 1597 fibonacciA = 987 fibonacciB = 1597 fibonacciC = 2584 sumEven = 3382 fibonacciA = 1597 fibonacciB = 2584 fibonacciC = 4181 fibonacciA = 2584 fibonacciB = 4181 fibonacciC = 6765 fibonacciA = 4181 fibonacciB = 6765 fibonacciC = 10946 sumEven = 14328 fibonacciA = 6765 fibonacciB = 10946 fibonacciC = 17711 fibonacciA = 10946 fibonacciB = 17711 fibonacciC = 28657 fibonacciA = 17711 fibonacciB = 28657 fibonacciC = 46368 sumEven = 60696 fibonacciA = 28657 fibonacciB = 46368 fibonacciC = 75025 fibonacciA = 46368 fibonacciB = 75025 fibonacciC = 121393 fibonacciA = 75025 fibonacciB = 121393 fibonacciC = 196418 sumEven = 257114 fibonacciA = 121393 fibonacciB = 196418 fibonacciC = 317811 fibonacciA = 196418 fibonacciB = 317811 fibonacciC = 514229 fibonacciA = 317811 fibonacciB = 514229 fibonacciC = 832040 sumEven = 1089154 fibonacciA = 514229 fibonacciB = 832040 fibonacciC = 1346269 fibonacciA = 832040 fibonacciB = 1346269 fibonacciC = 2178309 fibonacciA = 1346269 fibonacciB = 2178309 fibonacciC = 3524578 sumEven = 4613732 fibonacciA = 2178309 fibonacciB = 3524578 fibonacciC = 5702887 fibonacciA = 3524578 fibonacciB = 5702887 fibonacciC = 9227465 fibonacciA = 5702887 fibonacciB = 9227465 fibonacciC = 14930352 sumEven = 19544084 fibonacciA = 9227465 fibonacciB = 14930352 fibonacciC = 24157817 fibonacciA = 14930352 fibonacciB = 24157817 fibonacciC = 39088169 fibonacciA = 24157817 fibonacciB = 39088169 fibonacciC = 63245986 sumEven = 82790070 fibonacciA = 39088169 fibonacciB = 63245986 fibonacciC = 102334155 fibonacciA = 63245986 fibonacciB = 102334155 fibonacciC = 165580141 fibonacciA = 102334155 fibonacciB = 165580141 fibonacciC = 267914296 sumEven = 350704366 fibonacciA = 165580141 fibonacciB = 267914296 fibonacciC = 433494437 fibonacciA = 267914296 fibonacciB = 433494437 fibonacciC = 701408733 y = 350704366

4   Pass
x =666576 y_correct = 257114; assert(isequal(euler002(x),y_correct))

x = 666576 fibonacci = 1 1 1 1 1 1 1 1 1 fibonacciA = 1 fibonacciB = 2 fibonacciC = 3 i = 3 sumEven = 2 fibonacciC = 3 fibonacciA = 2 fibonacciB = 3 fibonacciC = 5 fibonacciA = 3 fibonacciB = 5 fibonacciC = 8 sumEven = 10 fibonacciA = 5 fibonacciB = 8 fibonacciC = 13 fibonacciA = 8 fibonacciB = 13 fibonacciC = 21 fibonacciA = 13 fibonacciB = 21 fibonacciC = 34 sumEven = 44 fibonacciA = 21 fibonacciB = 34 fibonacciC = 55 fibonacciA = 34 fibonacciB = 55 fibonacciC = 89 fibonacciA = 55 fibonacciB = 89 fibonacciC = 144 sumEven = 188 fibonacciA = 89 fibonacciB = 144 fibonacciC = 233 fibonacciA = 144 fibonacciB = 233 fibonacciC = 377 fibonacciA = 233 fibonacciB = 377 fibonacciC = 610 sumEven = 798 fibonacciA = 377 fibonacciB = 610 fibonacciC = 987 fibonacciA = 610 fibonacciB = 987 fibonacciC = 1597 fibonacciA = 987 fibonacciB = 1597 fibonacciC = 2584 sumEven = 3382 fibonacciA = 1597 fibonacciB = 2584 fibonacciC = 4181 fibonacciA = 2584 fibonacciB = 4181 fibonacciC = 6765 fibonacciA = 4181 fibonacciB = 6765 fibonacciC = 10946 sumEven = 14328 fibonacciA = 6765 fibonacciB = 10946 fibonacciC = 17711 fibonacciA = 10946 fibonacciB = 17711 fibonacciC = 28657 fibonacciA = 17711 fibonacciB = 28657 fibonacciC = 46368 sumEven = 60696 fibonacciA = 28657 fibonacciB = 46368 fibonacciC = 75025 fibonacciA = 46368 fibonacciB = 75025 fibonacciC = 121393 fibonacciA = 75025 fibonacciB = 121393 fibonacciC = 196418 sumEven = 257114 fibonacciA = 121393 fibonacciB = 196418 fibonacciC = 317811 fibonacciA = 196418 fibonacciB = 317811 fibonacciC = 514229 fibonacciA = 317811 fibonacciB = 514229 fibonacciC = 832040 y = 257114