Cody

Solution 2023930

Submitted on 16 Nov 2019 at 6:34 by Doan Quang Manh
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_correct = 1; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 a = 0 b = 1 f = 1

2   Pass
n = 4; f_correct = [1 3]; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 f = 3.0000 y = 1 1 1 2 3 k = 5 f = 5.0000 y = 1 1 1 2 3 5 k = 6 a = 1 b = 3 n = 1 y = 1 1 1 a = 0 b = 3 1 f = 1 3

3   Pass
n = 6; f_correct = [1 5]; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 f = 3.0000 y = 1 1 1 2 3 k = 5 f = 5.0000 y = 1 1 1 2 3 5 k = 6 f = 8.0000 y = 1 1 1 2 3 5 8 k = 7 a = 1 b = 5 n = 1 y = 1 1 1 a = 0 b = 5 1 f = 1 5

4   Pass
n = 2010; f_correct = [2 34 377 1597]; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 f = 3.0000 y = 1 1 1 2 3 k = 5 f = 5.0000 y = 1 1 1 2 3 5 k = 6 f = 8.0000 y = 1 1 1 2 3 5 8 k = 7 f = 13.0000 y = 1 1 1 2 3 5 8 13 k = 8 f = 21.0000 y = 1 1 1 2 3 5 8 13 21 k = 9 f = 34.0000 y = 1 1 1 2 3 5 8 13 21 34 k = 10 f = 55.0000 y = 1 1 1 2 3 5 8 13 21 34 55 k = 11 f = 89.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 k = 12 f = 144.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 k = 13 f = 233.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 k = 14 f = 377.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 k = 15 f = 610.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 k = 16 f = 987.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 k = 17 f = 1.5970e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 18 610 987 1597 k = 18 f = 2.5840e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 19 610 987 1597 2584 k = 19 a = 413 b = 1597 n = 413 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 a = 36 b = 1597 377 n = 36 y = 1 1 1 2 3 5 8 13 21 34 a = 2 b = 1597 377 34 n = 2 y = 1 1 1 2 a = 0 b = 1597 377 34 2 f = 2 34 377 1597

5   Pass
n = 35601; f_correct = [1 34 144 6765 28657]; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 f = 3.0000 y = 1 1 1 2 3 k = 5 f = 5.0000 y = 1 1 1 2 3 5 k = 6 f = 8.0000 y = 1 1 1 2 3 5 8 k = 7 f = 13.0000 y = 1 1 1 2 3 5 8 13 k = 8 f = 21.0000 y = 1 1 1 2 3 5 8 13 21 k = 9 f = 34.0000 y = 1 1 1 2 3 5 8 13 21 34 k = 10 f = 55.0000 y = 1 1 1 2 3 5 8 13 21 34 55 k = 11 f = 89.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 k = 12 f = 144.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 k = 13 f = 233.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 k = 14 f = 377.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 k = 15 f = 610.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 k = 16 f = 987.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 k = 17 f = 1.5970e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 18 610 987 1597 k = 18 f = 2.5840e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 19 610 987 1597 2584 k = 19 f = 4.1810e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 20 610 987 1597 2584 4181 k = 20 f = 6.7650e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 21 610 987 1597 2584 4181 6765 k = 21 f = 1.0946e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 22 610 987 1597 2584 4181 6765 10946 k = 22 f = 1.7711e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 23 610 987 1597 2584 4181 6765 10946 17711 k = 23 f = 2.8657e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 24 610 987 1597 2584 4181 6765 10946 17711 28657 k = 24 f = 4.6368e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 25 610 987 1597 2584 4181 6765 10946 17711 28657 46368 k = 25 a = 6944 b = 28657 n = 6944 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 21 610 987 1597 2584 4181 6765 a = 179 b = 28657 6765 n = 179 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 a = 35 b = 28657 6765 144 n = 35 y = 1 1 1 2 3 5 8 13 21 34 a = 1 b = 28657 6765 144 34 n = 1 y = 1 1 1 a = 0 b = 28657 6765 144 34 1 f = 1 34 144 6765 28657

6   Pass
n = 9227467; f_correct = [2 9227465]; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 f = 3.0000 y = 1 1 1 2 3 k = 5 f = 5.0000 y = 1 1 1 2 3 5 k = 6 f = 8.0000 y = 1 1 1 2 3 5 8 k = 7 f = 13.0000 y = 1 1 1 2 3 5 8 13 k = 8 f = 21.0000 y = 1 1 1 2 3 5 8 13 21 k = 9 f = 34.0000 y = 1 1 1 2 3 5 8 13 21 34 k = 10 f = 55.0000 y = 1 1 1 2 3 5 8 13 21 34 55 k = 11 f = 89.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 k = 12 f = 144.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 k = 13 f = 233.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 k = 14 f = 377.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 k = 15 f = 610.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 k = 16 f = 987.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 k = 17 f = 1.5970e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 18 610 987 1597 k = 18 f = 2.5840e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 19 610 987 1597 2584 k = 19 f = 4.1810e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 20 610 987 1597 2584 4181 k = 20 f = 6.7650e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 21 610 987 1597 2584 4181 6765 k = 21 f = 1.0946e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 22 610 987 1597 2584 4181 6765 10946 k = 22 f = 1.7711e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 23 610 987 1597 2584 4181 6765 10946 17711 k = 23 f = 2.8657e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 24 610 987 1597 2584 4181 6765 10946 17711 28657 k = 24 f = 4.6368e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 25 610 987 1597 2584 4181 6765 10946 17711 28657 46368 k = 25 f = 7.5025e+04 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 26 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 k = 26 f = 1.2139e+05 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 27 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 k = 27 f = 1.9642e+05 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 28 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 k = 28 f = 3.1781e+05 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 29 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 k = 29 f = 5.1423e+05 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 k = 30 f = 8.3204e+05 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 Column 31 832040 k = 31 f = 1.3463e+06 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 Columns 31 through 32 832040 1346269 k = 32 f = 2.1783e+06 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 Columns 31 through 33 832040 1346269 2178309 k = 33 f = 3.5246e+06 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 Columns 31 through 34 832040 1346269 2178309 3524578 k = 34 f = 5.7029e+06 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 Columns 31 through 35 832040 1346269 2178309 3524578 5702887 k = 35 f = 9.2275e+06 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 Columns 31 through 36 832040 1346269 2178309 3524578 5702887 9227465 k = 36 f = 1.4930e+07 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 30 610 987 1597 2584 4181 6765 10946 17711 28657 ...

7   Pass
n = 2015; f_correct = [2 5 34 377 1597]; assert(isequal(fib_decomposition(n),f_correct))

f = 1 y = 1 1 k = 2 f = 1 y = 1 1 1 k = 3 f = 2 y = 1 1 1 2 k = 4 f = 3.0000 y = 1 1 1 2 3 k = 5 f = 5.0000 y = 1 1 1 2 3 5 k = 6 f = 8.0000 y = 1 1 1 2 3 5 8 k = 7 f = 13.0000 y = 1 1 1 2 3 5 8 13 k = 8 f = 21.0000 y = 1 1 1 2 3 5 8 13 21 k = 9 f = 34.0000 y = 1 1 1 2 3 5 8 13 21 34 k = 10 f = 55.0000 y = 1 1 1 2 3 5 8 13 21 34 55 k = 11 f = 89.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 k = 12 f = 144.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 k = 13 f = 233.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 k = 14 f = 377.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 k = 15 f = 610.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 k = 16 f = 987.0000 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 k = 17 f = 1.5970e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 18 610 987 1597 k = 18 f = 2.5840e+03 y = Columns 1 through 15 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 16 through 19 610 987 1597 2584 k = 19 a = 418 b = 1597 n = 418 y = 1 1 1 2 3 5 8 13 21 34 55 89 144 233 377 a = 41 b = 1597 377 n = 41 y = 1 1 1 2 3 5 8 13 21 34 a = 7 b = 1597 377 34 n = 7 y = 1 1 1 2 3 5 a = 2 b = 1597 377 34 5 n = 2 y = 1 1 1 2 a = 0 b = 1597 377 34 5 2 f = 2 5 34 377 1597

Suggested Problems

More from this Author49