Cody

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

Solution 1985715

Submitted on 22 Oct 2019 by Hieu Tran
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 a = 1 b = 2 sum = 0 temp = 2 b = 3 a = 2 temp = 3 b = 5 a = 3 temp = 5 b = 8 a = 5 temp = 8 b = 13 a = 8 temp = 13 b = 21 a = 13 temp = 21 b = 34 a = 21 temp = 34 b = 55 a = 34 temp = 55 b = 89 a = 55 temp = 89 b = 144 a = 89 temp = 144 b = 233 a = 144 temp = 233 b = 377 a = 233 temp = 377 b = 610 a = 377 temp = 610 b = 987 a = 610 temp = 987 b = 1597 a = 987 temp = 1597 b = 2584 a = 1597 temp = 2584 b = 4181 a = 2584 temp = 4181 b = 6765 a = 4181 temp = 6765 b = 10946 a = 6765 temp = 10946 b = 17711 a = 10946 temp = 17711 b = 28657 a = 17711 temp = 28657 b = 46368 a = 28657 temp = 46368 b = 75025 a = 46368 temp = 75025 b = 121393 a = 75025 temp = 121393 b = 196418 a = 121393 temp = 196418 b = 317811 a = 196418 temp = 317811 b = 514229 a = 317811 temp = 514229 b = 832040 a = 514229 temp = 832040 b = 1346269 a = 832040 temp = 1346269 b = 2178309 a = 1346269 temp = 2178309 b = 3524578 a = 2178309 temp = 3524578 b = 5702887 a = 3524578 y = 4613732

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

x = 97455000 a = 1 b = 2 sum = 0 temp = 2 b = 3 a = 2 temp = 3 b = 5 a = 3 temp = 5 b = 8 a = 5 temp = 8 b = 13 a = 8 temp = 13 b = 21 a = 13 temp = 21 b = 34 a = 21 temp = 34 b = 55 a = 34 temp = 55 b = 89 a = 55 temp = 89 b = 144 a = 89 temp = 144 b = 233 a = 144 temp = 233 b = 377 a = 233 temp = 377 b = 610 a = 377 temp = 610 b = 987 a = 610 temp = 987 b = 1597 a = 987 temp = 1597 b = 2584 a = 1597 temp = 2584 b = 4181 a = 2584 temp = 4181 b = 6765 a = 4181 temp = 6765 b = 10946 a = 6765 temp = 10946 b = 17711 a = 10946 temp = 17711 b = 28657 a = 17711 temp = 28657 b = 46368 a = 28657 temp = 46368 b = 75025 a = 46368 temp = 75025 b = 121393 a = 75025 temp = 121393 b = 196418 a = 121393 temp = 196418 b = 317811 a = 196418 temp = 317811 b = 514229 a = 317811 temp = 514229 b = 832040 a = 514229 temp = 832040 b = 1346269 a = 832040 temp = 1346269 b = 2178309 a = 1346269 temp = 2178309 b = 3524578 a = 2178309 temp = 3524578 b = 5702887 a = 3524578 temp = 5702887 b = 9227465 a = 5702887 temp = 9227465 b = 14930352 a = 9227465 temp = 14930352 b = 24157817 a = 14930352 temp = 24157817 b = 39088169 a = 24157817 temp = 39088169 b = 63245986 a = 39088169 temp = 63245986 b = 102334155 a = 63245986 y = 82790070

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

x = 597455000 a = 1 b = 2 sum = 0 temp = 2 b = 3 a = 2 temp = 3 b = 5 a = 3 temp = 5 b = 8 a = 5 temp = 8 b = 13 a = 8 temp = 13 b = 21 a = 13 temp = 21 b = 34 a = 21 temp = 34 b = 55 a = 34 temp = 55 b = 89 a = 55 temp = 89 b = 144 a = 89 temp = 144 b = 233 a = 144 temp = 233 b = 377 a = 233 temp = 377 b = 610 a = 377 temp = 610 b = 987 a = 610 temp = 987 b = 1597 a = 987 temp = 1597 b = 2584 a = 1597 temp = 2584 b = 4181 a = 2584 temp = 4181 b = 6765 a = 4181 temp = 6765 b = 10946 a = 6765 temp = 10946 b = 17711 a = 10946 temp = 17711 b = 28657 a = 17711 temp = 28657 b = 46368 a = 28657 temp = 46368 b = 75025 a = 46368 temp = 75025 b = 121393 a = 75025 temp = 121393 b = 196418 a = 121393 temp = 196418 b = 317811 a = 196418 temp = 317811 b = 514229 a = 317811 temp = 514229 b = 832040 a = 514229 temp = 832040 b = 1346269 a = 832040 temp = 1346269 b = 2178309 a = 1346269 temp = 2178309 b = 3524578 a = 2178309 temp = 3524578 b = 5702887 a = 3524578 temp = 5702887 b = 9227465 a = 5702887 temp = 9227465 b = 14930352 a = 9227465 temp = 14930352 b = 24157817 a = 14930352 temp = 24157817 b = 39088169 a = 24157817 temp = 39088169 b = 63245986 a = 39088169 temp = 63245986 b = 102334155 a = 63245986 temp = 102334155 b = 165580141 a = 102334155 temp = 165580141 b = 267914296 a = 165580141 temp = 267914296 b = 433494437 a = 267914296 temp = 433494437 b = 701408733 a = 433494437 y = 350704366

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

x = 666576 a = 1 b = 2 sum = 0 temp = 2 b = 3 a = 2 temp = 3 b = 5 a = 3 temp = 5 b = 8 a = 5 temp = 8 b = 13 a = 8 temp = 13 b = 21 a = 13 temp = 21 b = 34 a = 21 temp = 34 b = 55 a = 34 temp = 55 b = 89 a = 55 temp = 89 b = 144 a = 89 temp = 144 b = 233 a = 144 temp = 233 b = 377 a = 233 temp = 377 b = 610 a = 377 temp = 610 b = 987 a = 610 temp = 987 b = 1597 a = 987 temp = 1597 b = 2584 a = 1597 temp = 2584 b = 4181 a = 2584 temp = 4181 b = 6765 a = 4181 temp = 6765 b = 10946 a = 6765 temp = 10946 b = 17711 a = 10946 temp = 17711 b = 28657 a = 17711 temp = 28657 b = 46368 a = 28657 temp = 46368 b = 75025 a = 46368 temp = 75025 b = 121393 a = 75025 temp = 121393 b = 196418 a = 121393 temp = 196418 b = 317811 a = 196418 temp = 317811 b = 514229 a = 317811 temp = 514229 b = 832040 a = 514229 y = 257114