Cody

# Problem 84. Longest Divisor Run

Solution 487433

Submitted on 18 Aug 2014 by bainhome
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
%% a = [93 1147 473 259 629 1591 851 533 2021 86 817 2279 1763 961 1073 205] len_correct = 5; d_correct = 43; [len,d] = divisor_run(a); assert(isequal(len,len_correct) && isequal(d,d_correct))

a = Columns 1 through 8 93 1147 473 259 629 1591 851 533 Columns 9 through 16 2021 86 817 2279 1763 961 1073 205 d = Columns 1 through 8 93 1147 473 259 629 1591 851 533 Columns 9 through 16 2021 86 817 2279 1763 961 1073 205 a = 31 1 1 37 37 37 1 1 43 43 43 43 1 1 1 d = 31 37 37 37 43 43 43 43 a = 1 1 1 37 37 1 1 1 43 43 43 1 1 1 d = 37 37 43 43 43 a = 1 1 1 37 1 1 1 1 43 43 1 1 1 d = 37 43 43 a = 1 1 1 1 1 1 1 1 43 1 1 1 d = 43 a = 1 1 1 1 1 1 1 1 1 1 1

2   Pass
%% a = [166 553 1241 869 237 395 1079 1577]; len_correct = 3; d_correct = 79; [len,d] = divisor_run(a); assert(isequal(len,len_correct) && isequal(d,d_correct))

d = 166 553 1241 869 237 395 1079 1577 a = 1 1 1 79 79 1 83 d = 79 79 83 a = 1 1 1 79 1 1 d = 79 a = 1 1 1 1 1

3   Pass
%% a = [533 205 123 287 451 697 82]; len_correct = 7; d_correct = 41; [len,d] = divisor_run(a); assert(isequal(len,len_correct) && isequal(d,d_correct))

d = 533 205 123 287 451 697 82 a = 41 41 41 41 41 41 d = 41 41 41 41 41 41 a = 41 41 41 41 41 d = 41 41 41 41 41 a = 41 41 41 41 d = 41 41 41 41 a = 41 41 41 d = 41 41 41 a = 41 41 d = 41 41 a = 41 d = 41 a = Empty matrix: 1-by-0

4   Pass
%% a = [3937 7493 1397 5633 6439 3151 5617 685 7261 5069 ... 959 3973 411 2603 2329 1781 262]; len_correct = 12; d_correct = 137; [len,d] = divisor_run(a); assert(isequal(len,len_correct) && isequal(d,d_correct))

d = Columns 1 through 8 3937 7493 1397 5633 6439 3151 5617 685 Columns 9 through 16 7261 5069 959 3973 411 2603 2329 1781 Column 17 262 a = 127 127 1 1 137 137 137 137 137 137 137 137 137 137 137 1 d = 127 127 137 137 137 137 137 137 137 137 137 137 137 a = 127 1 1 1 137 137 137 137 137 137 137 137 137 137 1 d = 127 137 137 137 137 137 137 137 137 137 137 a = 1 1 1 1 137 137 137 137 137 137 137 137 137 1 d = 137 137 137 137 137 137 137 137 137 a = 1 1 1 1 137 137 137 137 137 137 137 137 1 d = 137 137 137 137 137 137 137 137 a = 1 1 1 1 137 137 137 137 137 137 137 1 d = 137 137 137 137 137 137 137 a = 1 1 1 1 137 137 137 137 137 137 1 d = 137 137 137 137 137 137 a = 1 1 1 1 137 137 137 137 137 1 d = 137 137 137 137 137 a = 1 1 1 1 137 137 137 137 1 d = 137 137 137 137 a = 1 1 1 1 137 137 137 1 d = 137 137 137 a = 1 1 1 1 137 137 1 d = 137 137 a = 1 1 1 1 137 1 d = 137 a = 1 1 1 1 1