Cody

Solution 1586833

Submitted on 19 Jul 2018 by Ankith Rathod
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
X = fib_seq(34); assert(isequal(X(end),21) && length(X)==8)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 ans = 1 1 2 3 5 8 13 21

2   Pass
X = fib_seq(35); assert(isequal(X(end),34) && length(X)==9)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 prev = 13 y = 1 1 2 3 5 8 13 21 34 ans = 1 1 2 3 5 8 13 21 34

3   Pass
X = fib_seq(145); assert(isequal(X(end),144) && length(X)==12)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 prev = 13 y = 1 1 2 3 5 8 13 21 34 prev = 21 y = 1 1 2 3 5 8 13 21 34 55 prev = 34 y = 1 1 2 3 5 8 13 21 34 55 89 prev = 55 y = 1 1 2 3 5 8 13 21 34 55 89 144 ans = 1 1 2 3 5 8 13 21 34 55 89 144

4   Pass
X = fib_seq(4196); assert(isequal(X(end),4181) && length(X)==19)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 prev = 13 y = 1 1 2 3 5 8 13 21 34 prev = 21 y = 1 1 2 3 5 8 13 21 34 55 prev = 34 y = 1 1 2 3 5 8 13 21 34 55 89 prev = 55 y = 1 1 2 3 5 8 13 21 34 55 89 144 prev = 89 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 prev = 144 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 prev = 233 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 prev = 377 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 prev = 610 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 17 987 1597 prev = 987 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 18 987 1597 2584 prev = 1597 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181 ans = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181

5   Pass
X = fib_seq(987419996); assert(isequal(X(end),701408733) && length(X)==44)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 prev = 13 y = 1 1 2 3 5 8 13 21 34 prev = 21 y = 1 1 2 3 5 8 13 21 34 55 prev = 34 y = 1 1 2 3 5 8 13 21 34 55 89 prev = 55 y = 1 1 2 3 5 8 13 21 34 55 89 144 prev = 89 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 prev = 144 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 prev = 233 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 prev = 377 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 prev = 610 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 17 987 1597 prev = 987 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 18 987 1597 2584 prev = 1597 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181 prev = 2584 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 20 987 1597 2584 4181 6765 prev = 4181 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 21 987 1597 2584 4181 6765 10946 prev = 6765 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 22 987 1597 2584 4181 6765 10946 17711 prev = 10946 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 23 987 1597 2584 4181 6765 10946 17711 28657 prev = 17711 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 24 987 1597 2584 4181 6765 10946 17711 28657 46368 prev = 28657 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 25 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 prev = 46368 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 26 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 prev = 75025 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 27 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 prev = 121393 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 28 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 prev = 196418 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 29 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 prev = 317811 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 prev = 514229 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Column 31 1346269 prev = 832040 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 32 1346269 2178309 prev = 1346269 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 33 1346269 2178309 3524578 prev = 2178309 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 34 1346269 2178309 3524578 5702887 prev = 3524578 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 35 1346269 2178309 3524578 5702887 9227465 prev = 5702887 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 36 1346269 2178309 3524578 5702887 9227465 14930352 prev = 9227465 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 37 1346269 2178309 3524578 5702887 9227465 14930352 24157817 prev = 14930352 y = Columns 1 through 15 1 1 2 3 5 8 ...

6   Pass
X = fib_seq(1134903171); assert(isequal(X(end),1134903170) && length(X)==45)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 prev = 13 y = 1 1 2 3 5 8 13 21 34 prev = 21 y = 1 1 2 3 5 8 13 21 34 55 prev = 34 y = 1 1 2 3 5 8 13 21 34 55 89 prev = 55 y = 1 1 2 3 5 8 13 21 34 55 89 144 prev = 89 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 prev = 144 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 prev = 233 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 prev = 377 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 prev = 610 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 17 987 1597 prev = 987 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 18 987 1597 2584 prev = 1597 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181 prev = 2584 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 20 987 1597 2584 4181 6765 prev = 4181 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 21 987 1597 2584 4181 6765 10946 prev = 6765 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 22 987 1597 2584 4181 6765 10946 17711 prev = 10946 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 23 987 1597 2584 4181 6765 10946 17711 28657 prev = 17711 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 24 987 1597 2584 4181 6765 10946 17711 28657 46368 prev = 28657 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 25 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 prev = 46368 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 26 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 prev = 75025 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 27 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 prev = 121393 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 28 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 prev = 196418 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 29 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 prev = 317811 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 prev = 514229 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Column 31 1346269 prev = 832040 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 32 1346269 2178309 prev = 1346269 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 33 1346269 2178309 3524578 prev = 2178309 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 34 1346269 2178309 3524578 5702887 prev = 3524578 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 35 1346269 2178309 3524578 5702887 9227465 prev = 5702887 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 36 1346269 2178309 3524578 5702887 9227465 14930352 prev = 9227465 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 37 1346269 2178309 3524578 5702887 9227465 14930352 24157817 prev = 14930352 y = Columns 1 through 15 1 1 2 3 5 8 ...

7   Pass
X = fib_seq(98691443031971); assert(isequal(X(end),72723460248141) && length(X)==68)

y = 1 y = 1 1 prev = 1 y = 1 1 2 prev = 1 y = 1 1 2 3 prev = 2 y = 1 1 2 3 5 prev = 3 y = 1 1 2 3 5 8 prev = 5 y = 1 1 2 3 5 8 13 prev = 8 y = 1 1 2 3 5 8 13 21 prev = 13 y = 1 1 2 3 5 8 13 21 34 prev = 21 y = 1 1 2 3 5 8 13 21 34 55 prev = 34 y = 1 1 2 3 5 8 13 21 34 55 89 prev = 55 y = 1 1 2 3 5 8 13 21 34 55 89 144 prev = 89 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 prev = 144 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 prev = 233 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 prev = 377 y = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 prev = 610 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 17 987 1597 prev = 987 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 18 987 1597 2584 prev = 1597 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181 prev = 2584 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 20 987 1597 2584 4181 6765 prev = 4181 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 21 987 1597 2584 4181 6765 10946 prev = 6765 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 22 987 1597 2584 4181 6765 10946 17711 prev = 10946 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 23 987 1597 2584 4181 6765 10946 17711 28657 prev = 17711 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 24 987 1597 2584 4181 6765 10946 17711 28657 46368 prev = 28657 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 25 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 prev = 46368 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 26 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 prev = 75025 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 27 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 prev = 121393 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 28 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 prev = 196418 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 29 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 prev = 317811 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 prev = 514229 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Column 31 1346269 prev = 832040 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 32 1346269 2178309 prev = 1346269 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 33 1346269 2178309 3524578 prev = 2178309 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 34 1346269 2178309 3524578 5702887 prev = 3524578 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 35 1346269 2178309 3524578 5702887 9227465 prev = 5702887 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 36 1346269 2178309 3524578 5702887 9227465 14930352 prev = 9227465 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 37 1346269 2178309 3524578 5702887 9227465 14930352 24157817 prev = 14930352 y = Columns 1 through 15 1 1 2 3 5 8 ...

Suggested Problems

More from this Author7