Cody

# Problem 42340. Fibonacci Decomposition

Solution 1917560

Submitted on 31 Aug 2019 by Gatech AE
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))

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

i = 5 r = 1 1 2 3 i = 4 r = 1 1 2 i = 3 r = 1 1 i = 2 f = 1 3 n = 0

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

i = 6 r = 1 1 2 3 5 i = 5 r = 1 1 2 3 i = 4 r = 1 1 2 i = 3 r = 1 1 i = 2 f = 1 5 n = 0

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

i = 18 r = 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 i = 17 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 i = 16 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 i = 15 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 i = 14 f = 377 1597 n = 36 i = 14 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 i = 13 r = 1 1 2 3 5 8 13 21 34 55 89 144 i = 12 r = 1 1 2 3 5 8 13 21 34 55 89 i = 11 r = 1 1 2 3 5 8 13 21 34 55 i = 10 r = 1 1 2 3 5 8 13 21 34 i = 9 f = 34 377 1597 n = 2 i = 9 r = 1 1 2 3 5 8 13 21 i = 8 r = 1 1 2 3 5 8 13 i = 7 r = 1 1 2 3 5 8 i = 6 r = 1 1 2 3 5 i = 5 r = 1 1 2 3 i = 4 r = 1 1 2 i = 3 f = 2 34 377 1597 n = 0

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

i = 24 r = 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 i = 23 r = 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 i = 22 r = 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 i = 21 r = 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 i = 20 f = 6765 28657 n = 179 i = 20 r = 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 i = 19 r = 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 i = 18 r = 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 i = 17 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 i = 16 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 i = 15 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 i = 14 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 i = 13 r = 1 1 2 3 5 8 13 21 34 55 89 144 i = 12 f = 144 6765 28657 n = 35 i = 12 r = 1 1 2 3 5 8 13 21 34 55 89 i = 11 r = 1 1 2 3 5 8 13 21 34 55 i = 10 r = 1 1 2 3 5 8 13 21 34 i = 9 f = 34 144 6765 28657 n = 1 i = 9 r = 1 1 2 3 5 8 13 21 i = 8 r = 1 1 2 3 5 8 13 i = 7 r = 1 1 2 3 5 8 i = 6 r = 1 1 2 3 5 i = 5 r = 1 1 2 3 i = 4 r = 1 1 2 i = 3 r = 1 1 i = 2 f = 1 34 144 6765 28657 n = 0

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

i = 36 r = 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 i = 35 r = 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 i = 34 r = 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 i = 33 r = 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 i = 32 r = 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 i = 31 r = 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 i = 30 r = 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 i = 29 r = 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 i = 28 r = 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 i = 27 r = 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 i = 26 r = 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 i = 25 r = 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 i = 24 r = 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 i = 23 r = 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 i = 22 r = 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 i = 21 r = 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 i = 20 r = 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 i = 19 r = 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 i = 18 r = 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 i = 17 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 i = 16 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 i = 15 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 i = 14 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 i = 13 r = 1 1 2 3 5 8 13 21 34 55 89 144 i = 12 r = 1 1 2 3 5 8 13 21 34 55 89 i = 11 r = 1 1 2 3 5 8 13 21 34 55 i = 10 r = 1 1 2 3 5 8 13 21 34 i = 9 r = 1 1 2 3 5 8 13 21 i = 8 r = 1 1 2 3 5 8 13 i = 7 r = 1 1 2 3 5 8 i = 6 r = 1 1 2 3 5 i = 5 r = 1 1 2 3 i = 4 r = 1 1 2 i = 3 f = 2 9227465 n = 0

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

i = 18 r = 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 i = 17 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 i = 16 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 i = 15 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 i = 14 f = 377 1597 n = 41 i = 14 r = 1 1 2 3 5 8 13 21 34 55 89 144 233 i = 13 r = 1 1 2 3 5 8 13 21 34 55 89 144 i = 12 r = 1 1 2 3 5 8 13 21 34 55 89 i = 11 r = 1 1 2 3 5 8 13 21 34 55 i = 10 r = 1 1 2 3 5 8 13 21 34 i = 9 f = 34 377 1597 n = 7 i = 9 r = 1 1 2 3 5 8 13 21 i = 8 r = 1 1 2 3 5 8 13 i = 7 r = 1 1 2 3 5 8 i = 6 r = 1 1 2 3 5 i = 5 f = 5 34 377 1597 n = 2 i = 5 r = 1 1 2 3 i = 4 r = 1 1 2 i = 3 f = 2 5 34 377 1597 n = 0