Cody

# Problem 84. Longest Divisor Run

Solution 1878405

Submitted on 18 Jul 2019 by Aidan Kwok
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 15 93 1147 473 259 629 1591 851 533 2021 86 817 2279 1763 961 1073 Column 16 205 g = 93 g = 93 g = 93 g = 93 g = 93 g = 93 g = 93 g = 93 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 473 g = 259 g = 259 g = 259 g = 259 g = 259 g = 259 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 259 g = 259 g = 259 g = 259 g = 259 g = 259 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 259 g = 259 g = 259 g = 259 g = 259 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 629 g = 629 g = 533 g = 533 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 851 g = 533 g = 533 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 533 g = 533 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 533 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 86 g = 817 g = 817 g = 817 g = 817 g = 205 g = 1763 g = 961 g = 961 g = 205 g = 961 g = 961 g = 205 g = 961 g = 205 g = 205

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))

g = 166 g = 166 g = 166 g = 166 g = 166 g = 166 g = 166 g = 553 g = 553 g = 237 g = 237 g = 237 g = 237 g = 869 g = 237 g = 237 g = 237 g = 237 g = 237 g = 237 g = 237 g = 237 g = 237 g = 237 g = 237 g = 395 g = 395 g = 1079

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))

g = 205 g = 123 g = 123 g = 123 g = 123 g = 82 g = 123 g = 123 g = 123 g = 123 g = 82 g = 123 g = 123 g = 123 g = 82 g = 287 g = 287 g = 82 g = 451 g = 82 g = 82

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))

g = 3937 g = 1397 g = 1397 g = 1397 g = 1397 g = 1397 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 1397 g = 1397 g = 1397 g = 1397 g = 1397 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 1397 g = 1397 g = 1397 g = 1397 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 5633 g = 3151 g = 3151 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 3151 g = 3151 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 3151 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 685 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 685 g = 685 g = 685 g = 685 g = 411 g = 411 g = 411 g = 411 g = 262 g = 5069 g = 959 g = 959 g = 411 g = 411 g = 411 g = 411 g = 262 g = 959 g = 959 g = 411 g = 411 g = 411 g = 411 g = 262 g = 959 g = 411 g = 411 g = 411 g = 411 g = 262 g = 411 g = 411 g = 411 g = 411 g = 262 g = 411 g = 411 g = 411 g = 262 g = 2329 g = 1781 g = 262 g = 1781 g = 262 g = 262