Cody

# Problem 12. Fibonacci sequence

Solution 2065565

Submitted on 20 Dec 2019 by Alistair James
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; f = 1; assert(isequal(fib(n),f))

temp = 0 1 f = 1

2   Pass
n = 6; f = 8; assert(isequal(fib(n),f))

temp = 0 1 new = 1 temp = 0 1 1 new = 2 temp = 0 1 1 2 new = 3 temp = 0 1 1 2 3 new = 5 temp = 0 1 1 2 3 5 new = 8 temp = 0 1 1 2 3 5 8 new = 13 temp = 0 1 1 2 3 5 8 13

3   Pass
n = 10; f = 55; assert(isequal(fib(n),f))

temp = 0 1 new = 1 temp = 0 1 1 new = 2 temp = 0 1 1 2 new = 3 temp = 0 1 1 2 3 new = 5 temp = 0 1 1 2 3 5 new = 8 temp = 0 1 1 2 3 5 8 new = 13 temp = 0 1 1 2 3 5 8 13 new = 21 temp = 0 1 1 2 3 5 8 13 21 new = 34 temp = 0 1 1 2 3 5 8 13 21 34 new = 55 temp = 0 1 1 2 3 5 8 13 21 34 55 new = 89 temp = 0 1 1 2 3 5 8 13 21 34 55 89

4   Pass
n = 20; f = 6765; assert(isequal(fib(n),f))

temp = 0 1 new = 1 temp = 0 1 1 new = 2 temp = 0 1 1 2 new = 3 temp = 0 1 1 2 3 new = 5 temp = 0 1 1 2 3 5 new = 8 temp = 0 1 1 2 3 5 8 new = 13 temp = 0 1 1 2 3 5 8 13 new = 21 temp = 0 1 1 2 3 5 8 13 21 new = 34 temp = 0 1 1 2 3 5 8 13 21 34 new = 55 temp = 0 1 1 2 3 5 8 13 21 34 55 new = 89 temp = 0 1 1 2 3 5 8 13 21 34 55 89 new = 144 temp = 0 1 1 2 3 5 8 13 21 34 55 89 144 new = 233 temp = 0 1 1 2 3 5 8 13 21 34 55 89 144 233 new = 377 temp = 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 new = 610 temp = 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 new = 987 temp = 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 new = 1597 temp = Columns 1 through 15 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 18 610 987 1597 new = 2584 temp = Columns 1 through 15 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 19 610 987 1597 2584 new = 4181 temp = Columns 1 through 15 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 20 610 987 1597 2584 4181 new = 6765 temp = Columns 1 through 15 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 21 610 987 1597 2584 4181 6765 new = 10946 temp = Columns 1 through 15 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 22 610 987 1597 2584 4181 6765 10946