Cody

# Problem 44337. Sums of Distinct Powers

Solution 1950443

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

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); 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))

Unrecognized function or variable 'ned'. Error in sum_distinct_powers (line 2) pp=de2bi(nstart-1:ned-1); Error in Test8>@(base)sum_distinct_powers(base,nstart,nend) (line 2) junk=arrayfun(@(base) sum_distinct_powers(base,nstart,nend),2:10); Error in Test8 (line 2) junk=arrayfun(@(base) sum_distinct_powers(base,nstart,nend),2:10);