Cody

# Problem 12. Fibonacci sequence

Solution 1434148

Submitted on 5 Feb 2018 by Ni Yiyu
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 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1

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

f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1

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

f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = 1 f = ...

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
{"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, "url": "https://kr.mathworks.com/matlabcentral/cody/problems/12-fibonacci-sequence/solutions/1434148", "fetch_time": 1606587481000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2020-50/segments/1606141195687.51/warc/CC-MAIN-20201128155305-20201128185305-00148.warc.gz", "warc_record_offset": 375372825, "warc_record_length": 17316, "token_count": 3304, "char_count": 5264, "score": 3.734375, "int_score": 4, "crawl": "CC-MAIN-2020-50", "snapshot_type": "latest", "language": "en", "language_score": 0.5333539247512817, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00010-of-00064.parquet"}