Cody

# Problem 42839. Identify the sequence

Solution 883780

Submitted on 28 Apr 2016
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 = 1:8; y_correct = 1; assert(isequal(stype(x),y_correct))

2   Pass
x = 2.^(1:8); y_correct = 2; assert(isequal(stype(x),y_correct))

3   Pass
x = [1 1 2 3 5 8 13 21 34]; y_correct = 0; assert(isequal(stype(x),y_correct))

4   Pass
x = ones(1,80); y_correct1 = 1; y_correct2 = 2; assert(isequal(stype(x),y_correct1)|isequal(stype(x),y_correct2))

5   Pass
x = [ones(1,40) 0 ones(1,40)]; y_correct = 0; assert(isequal(stype(x),y_correct))

6   Pass
x = [exp(1) exp(3) exp(5) exp(7) exp(9)]; y_correct = 2; assert(isequal(stype(x),y_correct))

7   Pass
x = [-64 32 -16 8 -4 2 -1 0.5 -0.25]; y_correct = 2; assert(isequal(stype(x),y_correct))

8   Pass
x = [-9.6 -9.7 -9.8 -9.9 -10 -10.1 -10.2 -10.3 -10.4]; y_correct = 1; assert(isequal(stype(x),y_correct))

9   Fail
x = [1 1 -1 -1]; y_correct = 0; assert(isequal(stype(x),y_correct))

Assertion failed.

10   Fail
x = [i 3i 5i 7i]; y_correct = 1; assert(isequal(stype(x),y_correct))

Error using stype (line 2) Input A must be a real full matrix of type single or double.

11   Fail
x = [i -2 -4i 8 16i]; y_correct = 2; assert(isequal(stype(x),y_correct))

Error using stype (line 2) Input A must be a real full matrix of type single or double.