Cody

Problem 47058. Determine the Zeckendorf expansion of a number

Solution 3370363

Submitted on 25 Oct 2020 by Nikolaos Nikolaou
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
x = 26; y_correct = [21 5]; assert(isequal(Zeckendorf(x),y_correct))

y = 21 5

2   Pass
x = 26; y_correct = [21 5]; assert(isequal(Zeckendorf(x),y_correct))

y = 21 5

3   Pass
x = 88; y_correct = [55 21 8 3 1]; assert(isequal(Zeckendorf(x),y_correct))

y = 55 21 8 3 1

4   Pass
x = 965; y_correct = [610 233 89 21 8 3 1]; assert(isequal(Zeckendorf(x),y_correct))

y = 610 233 89 21 8 3 1

5   Pass
x = 4180; y_correct = [2584 987 377 144 55 21 8 3 1]; assert(isequal(Zeckendorf(x),y_correct))

y = 2584 987 377 144 55 21 8 3 1

6   Pass
x = 75024; y_correct = [46368 17711 6765 2584 987 377 144 55 21 8 3 1]; assert(isequal(Zeckendorf(x),y_correct))

y = 46368 17711 6765 2584 987 377 144 55 21 8 3 1

7   Pass
x = 514228; y_correct = [317811 121393 46368 17711 6765 2584 987 377 144 55 21 8 3 1]; assert(isequal(Zeckendorf(x),y_correct))

y = 317811 121393 46368 17711 6765 2584 987 377 144 55 21 8 3 1

8   Pass
x = 514229; y_correct = 514229; assert(isequal(Zeckendorf(x),y_correct))

y = 514229

9   Pass
x = 8675309; y_correct = [5702887 2178309 514229 196418 75025 6765 1597 55 21 3]; assert(isequal(Zeckendorf(x),y_correct))

y = 5702887 2178309 514229 196418 75025 6765 1597 55 21 3

10   Pass
x = 2022243254; y_correct = [1836311903 165580141 14930352 3524578 1346269 514229 28657 6765 233 89 34 3 1]; assert(isequal(Zeckendorf(x),y_correct))

y = 1.0e+09 * 1.8363 0.1656 0.0149 0.0035 0.0013 0.0005 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

11   Pass
x = 314159265358; y_correct = [225851433717 86267571272 1836311903 165580141 24157817 9227465 3524578 1346269 75025 28657 6765 1597 144 8]; assert(isequal(Zeckendorf(x),y_correct))

y = 1.0e+11 * 2.2585 0.8627 0.0184 0.0017 0.0002 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000