Cody

# Problem 45223. find nth even fibonacci number

Solution 2124868

Submitted on 11 Feb 2020 by Chris J
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
n = 1; y_correct = 2; assert(isequal(even_fib(n),y_correct))

f = 1 1 2

2   Pass
n = 3; y_correct = 34; assert(isequal(even_fib(n),y_correct))

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 f = 1 1 2 3 5 8 13 f = 1 1 2 3 5 8 13 21 f = 1 1 2 3 5 8 13 21 34

3   Pass
n = 10; y_correct = 832040; assert(isequal(even_fib(n),y_correct))

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 f = 1 1 2 3 5 8 13 f = 1 1 2 3 5 8 13 21 f = 1 1 2 3 5 8 13 21 34 f = 1 1 2 3 5 8 13 21 34 55 f = 1 1 2 3 5 8 13 21 34 55 89 f = 1 1 2 3 5 8 13 21 34 55 89 144 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040

4   Pass
n = 20; y_correct = 1548008755920; assert(isequal(even_fib(n),y_correct))

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 f = 1 1 2 3 5 8 13 f = 1 1 2 3 5 8 13 21 f = 1 1 2 3 5 8 13 21 34 f = 1 1 2 3 5 8 13 21 34 55 f = 1 1 2 3 5 8 13 21 34 55 89 f = 1 1 2 3 5 8 13 21 34 55 89 144 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 ...