Cody

# Problem 42340. Fibonacci Decomposition

Solution 2026245

Submitted on 18 Nov 2019 by Luu Van Duc
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))

h = [] j = 1 h = 1 n = 0 j = 2 f = 1

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

h = [] j = 1 h = 3 n = 1 j = 2 h = 3 1 n = 0 j = 3 f = 1 3

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

h = [] j = 1 h = 5 n = 1 j = 2 h = 5 1 n = 0 j = 3 f = 1 5

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

h = [] j = 1 h = 1597 n = 413 j = 2 h = 1597 377 n = 36 j = 3 h = 1597 377 34 n = 2 j = 4 h = 1597 377 34 2 n = 0 j = 5 f = 2 34 377 1597

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

h = [] j = 1 h = 28657 n = 6944 j = 2 h = 28657 6765 n = 179 j = 3 h = 28657 6765 144 n = 35 j = 4 h = 28657 6765 144 34 n = 1 j = 5 h = 28657 6765 144 34 1 n = 0 j = 6 f = 1 34 144 6765 28657

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

h = [] j = 1 h = 9227465 n = 2 j = 2 h = 9227465 2 n = 0 j = 3 f = 2 9227465

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

h = [] j = 1 h = 1597 n = 418 j = 2 h = 1597 377 n = 41 j = 3 h = 1597 377 34 n = 7 j = 4 h = 1597 377 34 5 n = 2 j = 5 h = 1597 377 34 5 2 n = 0 j = 6 f = 2 5 34 377 1597