fork download
  1. function x=f(x,n)
  2. while x(2)>=x(1)
  3. x=[abs(x(1)-x(2)) x];end
  4. x=x([2 1]);for k=1:n-1
  5. x=[x(1)+x(2) x];end
  6. x=x(n:-1:1);
  7.  
  8. end %line needed in online interpreter only
  9.  
  10. f([8 13],10)
Success #stdin #stdout 0.18s 65048KB
stdin
Standard input is empty
stdout
ans =

    0    1    1    2    3    5    8   13   21   34