Cody

Problem 42340. Fibonacci Decomposition

Solution 1918283

Submitted on 1 Sep 2019 by Banister
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))

f = 3 f = 2 3 f = 1 3

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

f = 5 f = 3 5 f = 2 5 f = 1 5

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

f = 1597 f = 987 1597 f = 610 1597 f = 377 1597 f = 233 377 1597 f = 144 377 1597 f = 89 377 1597 f = 55 377 1597 f = 34 377 1597 f = 21 34 377 1597 f = 13 34 377 1597 f = 8 34 377 1597 f = 5 34 377 1597 f = 3 34 377 1597 f = 2 34 377 1597 f = 1 2 34 377 1597

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

f = 28657 f = 17711 28657 f = 10946 28657 f = 6765 28657 f = 4181 6765 28657 f = 2584 6765 28657 f = 1597 6765 28657 f = 987 6765 28657 f = 610 6765 28657 f = 377 6765 28657 f = 233 6765 28657 f = 144 6765 28657 f = 89 144 6765 28657 f = 55 144 6765 28657 f = 34 144 6765 28657 f = 21 34 144 6765 28657 f = 13 34 144 6765 28657 f = 8 34 144 6765 28657 f = 5 34 144 6765 28657 f = 3 34 144 6765 28657 f = 2 34 144 6765 28657 f = 1 34 144 6765 28657

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

f = 9227465 f = 5702887 9227465 f = 3524578 9227465 f = 2178309 9227465 f = 1346269 9227465 f = 832040 9227465 f = 514229 9227465 f = 317811 9227465 f = 196418 9227465 f = 121393 9227465 f = 75025 9227465 f = 46368 9227465 f = 28657 9227465 f = 17711 9227465 f = 10946 9227465 f = 6765 9227465 f = 4181 9227465 f = 2584 9227465 f = 1597 9227465 f = 987 9227465 f = 610 9227465 f = 377 9227465 f = 233 9227465 f = 144 9227465 f = 89 9227465 f = 55 9227465 f = 34 9227465 f = 21 9227465 f = 13 9227465 f = 8 9227465 f = 5 9227465 f = 3 9227465 f = 2 9227465 f = 1 2 9227465

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

f = 1597 f = 987 1597 f = 610 1597 f = 377 1597 f = 233 377 1597 f = 144 377 1597 f = 89 377 1597 f = 55 377 1597 f = 34 377 1597 f = 21 34 377 1597 f = 13 34 377 1597 f = 8 34 377 1597 f = 5 34 377 1597 f = 3 5 34 377 1597 f = 2 5 34 377 1597 f = 1 2 5 34 377 1597