Cody

# Problem 12. Fibonacci sequence

Solution 1300077

Submitted on 19 Oct 2017 by Robert Cline
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))

f = 1

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

f = 1 last = 1 now = 1 next = 0 next = 2 last = 1 now = 2 next = 3 last = 2 now = 3 next = 5 last = 3 now = 5 next = 8 last = 5 now = 8 f = 8

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

f = 1 last = 1 now = 1 next = 0 next = 2 last = 1 now = 2 next = 3 last = 2 now = 3 next = 5 last = 3 now = 5 next = 8 last = 5 now = 8 next = 13 last = 8 now = 13 next = 21 last = 13 now = 21 next = 34 last = 21 now = 34 next = 55 last = 34 now = 55 f = 55

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

f = 1 last = 1 now = 1 next = 0 next = 2 last = 1 now = 2 next = 3 last = 2 now = 3 next = 5 last = 3 now = 5 next = 8 last = 5 now = 8 next = 13 last = 8 now = 13 next = 21 last = 13 now = 21 next = 34 last = 21 now = 34 next = 55 last = 34 now = 55 next = 89 last = 55 now = 89 next = 144 last = 89 now = 144 next = 233 last = 144 now = 233 next = 377 last = 233 now = 377 next = 610 last = 377 now = 610 next = 987 last = 610 now = 987 next = 1597 last = 987 now = 1597 next = 2584 last = 1597 now = 2584 next = 4181 last = 2584 now = 4181 next = 6765 last = 4181 now = 6765 f = 6765