Cody

Problem 12. Fibonacci sequence

Solution 917413

Submitted on 30 Jun 2016 by Matt Tu
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 x = 1 y = 1

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

x = 1 y = 1 f = 2 x = 1 y = 2 f = 3 x = 2 y = 3 f = 5 x = 3 y = 5 f = 8 x = 5 y = 8

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

x = 1 y = 1 f = 2 x = 1 y = 2 f = 3 x = 2 y = 3 f = 5 x = 3 y = 5 f = 8 x = 5 y = 8 f = 13 x = 8 y = 13 f = 21 x = 13 y = 21 f = 34 x = 21 y = 34 f = 55 x = 34 y = 55

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

x = 1 y = 1 f = 2 x = 1 y = 2 f = 3 x = 2 y = 3 f = 5 x = 3 y = 5 f = 8 x = 5 y = 8 f = 13 x = 8 y = 13 f = 21 x = 13 y = 21 f = 34 x = 21 y = 34 f = 55 x = 34 y = 55 f = 89 x = 55 y = 89 f = 144 x = 89 y = 144 f = 233 x = 144 y = 233 f = 377 x = 233 y = 377 f = 610 x = 377 y = 610 f = 987 x = 610 y = 987 f = 1597 x = 987 y = 1597 f = 2584 x = 1597 y = 2584 f = 4181 x = 2584 y = 4181 f = 6765 x = 4181 y = 6765
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}