Return the Fibonacci Sequence - MATLAB Cody - MATLAB Central

Problem 434. Return the Fibonacci Sequence

Difficulty:Rate

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. For example,

>> fib_seq(34)
ans =
       1  1  2  3  5  8  13  21
>> fib_seq(35)
ans =
       1  1  2  3  5  8  13  21  34

Solution Stats

31.61% Correct | 68.39% Incorrect
Last Solution submitted on May 10, 2025

Problem Comments

Solution Comments

Show comments
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers1290

Suggested Problems

More from this Author6

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page