Cody

Problem 12. Fibonacci sequence

Solution 659876

Submitted on 24 Apr 2015 by Sergej Pauli
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))

an = 2 a1 = 1 an = 3 a1 = 2 an = 5 a1 = 3 an = 8 a1 = 5 an = 13 a1 = 8 f = 8

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

an = 2 a1 = 1 an = 3 a1 = 2 an = 5 a1 = 3 an = 8 a1 = 5 an = 13 a1 = 8 an = 21 a1 = 13 an = 34 a1 = 21 an = 55 a1 = 34 an = 89 a1 = 55 f = 55

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

an = 2 a1 = 1 an = 3 a1 = 2 an = 5 a1 = 3 an = 8 a1 = 5 an = 13 a1 = 8 an = 21 a1 = 13 an = 34 a1 = 21 an = 55 a1 = 34 an = 89 a1 = 55 an = 144 a1 = 89 an = 233 a1 = 144 an = 377 a1 = 233 an = 610 a1 = 377 an = 987 a1 = 610 an = 1597 a1 = 987 an = 2584 a1 = 1597 an = 4181 a1 = 2584 an = 6765 a1 = 4181 an = 10946 a1 = 6765 f = 6765