Cody

# Problem 44337. Sums of Distinct Powers

Solution 1899625

Submitted on 14 Aug 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
base=4;nstart=2;nend=6;y_correct=62; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 r = 1 r = 1 r = 4

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test1 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

2   Fail
base=5;nstart=1;nend=1000;y_correct=1193853250; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 t = 1 2 3 4 5 t = 1 2 3 4 5 6 t = 1 2 3 4 5 6 7 t = 1 2 3 4 5 6 7 8 t = 1 2 3 4 5 6 7 8 9 t = 1 2 3 4 5 6 7 8 9 10 t = 1 2 3 4 5 6 7 8 9 10 11 t = 1 2 3 4 5 6 7 8 9 10 11 12 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 52 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21...

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test2 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

3   Fail
base=3;nstart=1;nend=1000;y_correct=14438162; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 t = 1 2 3 4 5 t = 1 2 3 4 5 6 t = 1 2 3 4 5 6 7 t = 1 2 3 4 5 6 7 8 t = 1 2 3 4 5 6 7 8 9 t = 1 2 3 4 5 6 7 8 9 10 t = 1 2 3 4 5 6 7 8 9 10 11 t = 1 2 3 4 5 6 7 8 9 10 11 12 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 52 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21...

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test3 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

4   Fail
base=3;nstart=100;nend=1000;y_correct=14397354; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 t = 1 2 3 4 5 t = 1 2 3 4 5 6 t = 1 2 3 4 5 6 7 t = 1 2 3 4 5 6 7 8 t = 1 2 3 4 5 6 7 8 9 t = 1 2 3 4 5 6 7 8 9 10 t = 1 2 3 4 5 6 7 8 9 10 11 t = 1 2 3 4 5 6 7 8 9 10 11 12 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 52 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21...

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test4 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

5   Fail
base=2;nstart=1;nend=2017;y_correct=2035153; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 t = 1 2 3 4 5 t = 1 2 3 4 5 6 t = 1 2 3 4 5 6 7 t = 1 2 3 4 5 6 7 8 t = 1 2 3 4 5 6 7 8 9 t = 1 2 3 4 5 6 7 8 9 10 t = 1 2 3 4 5 6 7 8 9 10 11 t = 1 2 3 4 5 6 7 8 9 10 11 12 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 52 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21...

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test5 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

6   Fail
base=7;nstart=1234;nend=2345;y_correct=843569026324; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 t = 1 2 3 4 5 t = 1 2 3 4 5 6 t = 1 2 3 4 5 6 7 t = 1 2 3 4 5 6 7 8 t = 1 2 3 4 5 6 7 8 9 t = 1 2 3 4 5 6 7 8 9 10 t = 1 2 3 4 5 6 7 8 9 10 11 t = 1 2 3 4 5 6 7 8 9 10 11 12 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 52 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21...

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test6 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

7   Fail
base=7;nstart=1;nend=10;y_correct=1265; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 r = 1 r = 1 r = 7

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test7 (line 2) assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

8   Fail
nstart=1;nend=50; junk=arrayfun(@(base) sum_distinct_powers(base,nstart,nend),2:10); y_correct=[1275 7120 26365 75000 178591 374560 714465 1266280 2116675]; assert(isequal(junk,y_correct))

t = 1 t = 1 2 t = 1 2 3 t = 1 2 3 4 t = 1 2 3 4 5 t = 1 2 3 4 5 6 t = 1 2 3 4 5 6 7 t = 1 2 3 4 5 6 7 8 t = 1 2 3 4 5 6 7 8 9 t = 1 2 3 4 5 6 7 8 9 10 t = 1 2 3 4 5 6 7 8 9 10 11 t = 1 2 3 4 5 6 7 8 9 10 11 12 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 t = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 t = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 r = 1 r = 1 r = 2

Array indices must be positive integers or logical values. Error in sum_distinct_powers (line 13) r(end)=sum(r((end-i):end)) Error in Test8>@(base)sum_distinct_powers(base,nstart,nend) Error in Test8 (line 2) junk=arrayfun(@(base) sum_distinct_powers(base,nstart,nend),2:10);