Cody

# Problem 752. Is X a Fibonacci Matrix?

Solution 1972503

Submitted on 12 Oct 2019 by Tung Nguyen
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 = [0 1;1 1]; tf = true; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 1 2 3 z = 2 3 2 3 tf = logical 1

2   Pass
x = [1 0;1 1]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 2 3 1 z = 2 3 2 3 tf = logical 0

3   Pass
x = [0 1;1 1]^40; tf = true; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 40 41 z = 41 42 tf = logical 1

4   Pass
x = [0 1;1 1]^40+1; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 1×0 empty double row vector z = 1×0 empty double row vector tf = logical 0

5   Pass
x = [0 1;1 1]^17; tf = true; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 17 18 z = 18 19 tf = logical 1

6   Pass
x = [0 1;1 1]^17-5; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 1×0 empty double row vector z = 1×0 empty double row vector tf = logical 0

7   Pass
x = [0 0 1;0 1 1;1 1 1]^3; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 2 3 4 5 z = 4 6 z = 5 6 tf = logical 0

8   Pass
x = [0 0 1;0 1 1]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 1 1 2 3 z = 1 2 3 2 3 tf = logical 0

9   Pass
x = [[0 1;1 1]^3 [5; 8]]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 2 3 4 6 z = 4 5 7 tf = logical 0

10   Pass
x = uint8([0 1; 1 1]^5); tf = true; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 5 6 z = 6 7 tf = logical 1

11   Pass
x = -([0 1; 1 1]^5); tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 1×0 empty double row vector z = 1×0 empty double row vector tf = logical 0

12   Pass
x = [0 1; 1 1]^5; x(2) = nan; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 5 6 z = 7 tf = logical 0

13   Pass
x = [4 7;7 11]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

d = 100 z = 1×0 empty double row vector z = 1×0 empty double row vector tf = logical 0

14   Pass
for ii = 1:55 assert(true==isFibMat([0 1;1 1]^ii)) end

d = 100 z = 1 2 3 z = 2 3 2 3 tf = logical 1 d = 100 z = 2 3 2 3 z = 2 3 4 tf = logical 1 d = 100 z = 2 3 4 z = 4 5 tf = logical 1 d = 100 z = 4 5 z = 5 6 tf = logical 1 d = 100 z = 5 6 z = 6 7 tf = logical 1 d = 100 z = 6 7 z = 7 8 tf = logical 1 d = 100 z = 7 8 z = 8 9 tf = logical 1 d = 100 z = 8 9 z = 9 10 tf = logical 1 d = 100 z = 9 10 z = 10 11 tf = logical 1 d = 100 z = 10 11 z = 11 12 tf = logical 1 d = 100 z = 11 12 z = 12 13 tf = logical 1 d = 100 z = 12 13 z = 13 14 tf = logical 1 d = 100 z = 13 14 z = 14 15 tf = logical 1 d = 100 z = 14 15 z = 15 16 tf = logical 1 d = 100 z = 15 16 z = 16 17 tf = logical 1 d = 100 z = 16 17 z = 17 18 tf = logical 1 d = 100 z = 17 18 z = 18 19 tf = logical 1 d = 100 z = 18 19 z = 19 20 tf = logical 1 d = 100 z = 19 20 z = 20 21 tf = logical 1 d = 100 z = 20 21 z = 21 22 tf = logical 1 d = 100 z = 21 22 z = 22 23 tf = logical 1 d = 100 z = 22 23 z = 23 24 tf = logical 1 d = 100 z = 23 24 z = 24 25 tf = logical 1 d = 100 z = 24 25 z = 25 26 tf = logical 1 d = 100 z = 25 26 z = 26 27 tf = logical 1 d = 100 z = 26 27 z = 27 28 tf = logical 1 d = 100 z = 27 28 z = 28 29 tf = logical 1 d = 100 z = 28 29 z = 29 30 tf = logical 1 d = 100 z = 29 30 z = 30 31 tf = logical 1 d = 100 z = 30 31 z = 31 32 tf = logical 1 d = 100 z = 31 32 z = 32 33 tf = logical 1 d = 100 z = 32 33 z = 33 34 tf = logical 1 d = 100 z = 33 34 z = 34 35 tf = logical 1 d = 100 z = 34 35 z = 35 36 tf = logical 1 d = 100 z = 35 36 z = 36 37 tf = logical 1 d = 100 z = 36 37 z = 37 38 tf = logical 1 d = 100 z = 37 38 z = 38 39 tf = logical 1 d = 100 z = 38 39 z = 39 40 tf = logical 1 d = 100 z = 39 40 z = 40 41 tf = logical 1 d = 100 z = 40 41 z = 41 42 tf = logical 1 d = 100 z = 41 42 z = 42 43 tf = logical 1 d = 100 z = 42 43 z = 43 44 tf = logical 1 d = 100 z = 43 44 z = 44 45 tf = logical 1 d = 100 z = 44 45 z = 45 46 tf = logical 1 d = 100 z = 45 46 z = 46 47 tf = logical 1 d = 100 z = 46 47 z = 47 48 tf = logical 1 d = 100 z = 47 48 z = 48 49 tf = logical 1 d = 100 z = 48 49 z = 49 50 tf = logical 1 d = 100 z = 49 50 z = 50 51 tf = logical 1 d = 100 z = 50 51 z = 51 52 tf = logical 1 d = 100 z = 51 52 z = 52 53 tf = logical 1 d = 100 z = 52 53 z = 53 54 tf = logical 1 d = 100 z = 53 54 z = 54 55 tf = logical 1 d = 100 z = 54 55 z = 55 56 tf = logical 1 d = 100 z = 55 56 z = 56 57 tf = logical 1