Cody

# Problem 42340. Fibonacci Decomposition

Solution 3447058

Submitted on 28 Oct 2020 at 8:50
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   Fail
n = 1; f_correct = 1; assert(isequal(fib_decomposition(n),f_correct))

n = 0

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test1 (line 3) assert(isequal(fib_decomposition(n),f_correct))

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

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

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test2 (line 3) assert(isequal(fib_decomposition(n),f_correct))

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

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 n = 1

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test3 (line 3) assert(isequal(fib_decomposition(n),f_correct))

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

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 f = 1 1 2 3 5 8 13 f = 1 1 2 3 5 8 13 21 f = 1 1 2 3 5 8 13 21 34 f = 1 1 2 3 5 8 13 21 34 55 f = 1 1 2 3 5 8 13 21 34 55 89 f = 1 1 2 3 5 8 13 21 34 55 89 144 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 17 610 987 1597 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 18 610 987 1597 2584 n = 413

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test4 (line 3) assert(isequal(fib_decomposition(n),f_correct))

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

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 f = 1 1 2 3 5 8 13 f = 1 1 2 3 5 8 13 21 f = 1 1 2 3 5 8 13 21 34 f = 1 1 2 3 5 8 13 21 34 55 f = 1 1 2 3 5 8 13 21 34 55 89 f = 1 1 2 3 5 8 13 21 34 55 89 144 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 17 610 987 1597 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 18 610 987 1597 2584 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 19 610 987 1597 2584 4181 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 20 610 987 1597 2584 4181 6765 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 21 610 987 1597 2584 4181 6765 10946 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 22 610 987 1597 2584 4181 6765 10946 17711 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 23 610 987 1597 2584 4181 6765 10946 17711 28657 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 24 610 987 1597 2584 4181 6765 10946 17711 28657 46368 n = 6944

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test5 (line 3) assert(isequal(fib_decomposition(n),f_correct))

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

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

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test6 (line 3) assert(isequal(fib_decomposition(n),f_correct))

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

f = 1 1 2 f = 1 1 2 3 f = 1 1 2 3 5 f = 1 1 2 3 5 8 f = 1 1 2 3 5 8 13 f = 1 1 2 3 5 8 13 21 f = 1 1 2 3 5 8 13 21 34 f = 1 1 2 3 5 8 13 21 34 55 f = 1 1 2 3 5 8 13 21 34 55 89 f = 1 1 2 3 5 8 13 21 34 55 89 144 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 f = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 17 610 987 1597 f = Columns 1 through 14 1 1 2 3 5 8 13 21 34 55 89 144 233 377 Columns 15 through 18 610 987 1597 2584 n = 418

Unrecognized function or variable 'e'. Error in fib_decomposition (line 8) e=[e,max(f(f<=n))] Error in Test7 (line 3) assert(isequal(fib_decomposition(n),f_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!