Cody

# Problem 2800. arithmetic progression

Solution 1945331

Submitted on 22 Sep 2019
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   Fail
nterms = 10; term0 = randi(10); increment = (-1)^randi(2)*randi(10); correctsequence = term0:increment:term0+(nterms-1)*increment; for position = 1:nterms errorsequence = correctsequence; errorsequence(position) = errorsequence(position) + (-1)^randi(2)*randi(50); [errorposition, truesequence] = find_error(errorsequence); assert(errorposition == position && isequal(truesequence, correctsequence), 'failed test 1 at position %d', position); end

d = -45 -7 -7 -7 -7 -7 -7 -7 -7 m = -7 correz = 38 seq = 80 -3 -10 -17 -24 -31 -38 -45 -52 -59

failed test 1 at position 1

2   Fail
nterms = 201; term0 = randi(10); increment = (-1)^randi(2)*randi(10); correctsequence = term0:increment:term0+(nterms-1)*increment; for position = 1:10:nterms errorsequence = correctsequence; errorsequence(position) = errorsequence(position) + (-1)^randi(2)*randi(50); [errorposition, truesequence] = find_error(errorsequence); assert(errorposition == position && isequal(truesequence, correctsequence), 'failed test 2 at position %d', position); end

d = Columns 1 through 29 39 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 Columns 30 through 58 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 Columns 59 through 87 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 Columns 88 through 116 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 Columns 117 through 145 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 Columns 146 through 174 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 Columns 175 through 200 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 -9 m = -9 correz = -48 seq = Columns 1 through 14 -87 0 -9 -18 -27 -36 -45 -54 -63 -72 -81 -90 -99 -108 Columns 15 through 28 -117 -126 -135 -144 -153 -162 -171 -180 -189 -198 -207 -216 -225 -234 Columns 29 through 42 -243 -252 -261 -270 -279 -288 -297 -306 -315 -324 -333 -342 -351 -360 Columns 43 through 56 -369 -378 -387 -396 -405 -414 -423 -432 -441 -450 -459 -468 -477 -486 Columns 57 through 70 -495 -504 -513 -522 -531 -540 -549 -558 -567 -576 -585 -594 -603 -612 Columns 71 through 84 -621 -630 -639 -648 -657 -666 -675 -684 -693 -702 -711 -720 -729 -738 Columns 85 through 98 -747 -756 -765 -774 -783 -792 -801 -810 -819 -828 -837 -846 -855 -864 Columns 99 through 112 -873 -882 -891 -900 -909 -918 -927 -936 -945 -954 -963 -972 -981 -990 Columns 113 through 126 -999 -1008 -1017 -1026 -1035 -1044 -1053 -1062 -1071 -1080 -1089 -1098 -1107 -1116 Columns 127 through 140 -1125 -1134 -1143 -1152 -1161 -1170 -1179 -1188 -1197 -1206 -1215 -1224 -1233 -1242 Columns 141 through 154 -1251 -1260 -1269 -1278 -1287 -1296 -1305 -1314 -1323 -1332 -1341 -1350 -1359 -1368 Columns 155 through 168 -1377 -1386 -1395 -1404 -1413 -1422 -1431 -1440 -1449 -1458 -1467 -1476 -1485 -1494 Columns 169 through 182 -1503 -1512 -1521 -1530 -1539 -1548 -1557 -1566 -1575 -1584 -1593 -1602 -1611 -1620 Columns 183 through 196 -1629 -1638 -1647 -1656 -1665 -1674 -1683 -1692 -1701 -1710 -1719 -1728 -1737 -1746 Columns 197 through 201 -1755 -1764 -1773 -1782 -1791

failed test 2 at position 1