Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 61878

Submitted on 16 Mar 2012 by Nikolai

Correct

43Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
X = fib_seq(145);
assert(isequal(X(end),144) && length(X)==12)
{Warning: Size vector should be a row vector with integer
elements.}
{> In fib_seq at 2
  In verifyCode>evaluateCode at 189
  In verifyCode at 37
  In fevalJSON at 14}
2
Pass
 
%%
X = fib_seq(4196);
assert(isequal(X(end),4181) && length(X)==19)
{Warning: Size vector should be a row vector with integer
elements.}
{> In fib_seq at 2
  In verifyCode>evaluateCode at 189
  In verifyCode at 37
  In fevalJSON at 14}
3
Pass
 
%%
X = fib_seq(987419996);
assert(isequal(X(end),701408733) && length(X)==44)
{Warning: Size vector should be a row vector with integer
elements.}
{> In fib_seq at 2
  In verifyCode>evaluateCode at 189
  In verifyCode at 37
  In fevalJSON at 14}
4
Pass
 
%%
X = fib_seq(1134903171);
assert(isequal(X(end),1134903170) && length(X)==45)
{Warning: Size vector should be a row vector with integer
elements.}
{> In fib_seq at 2
  In verifyCode>evaluateCode at 189
  In verifyCode at 37
  In fevalJSON at 14}
5
Pass
 
%%
X = fib_seq(98691443031971);
assert(isequal(X(end),72723460248141) && length(X)==68)
{Warning: Size vector should be a row vector with integer
elements.}
{> In fib_seq at 2
  In verifyCode>evaluateCode at 189
  In verifyCode at 37
  In fevalJSON at 14}