Cody

Solution 1307782

Submitted on 21 Oct 2017 by Shawn Mengel
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
base=4;nstart=2;nend=6;y_correct=62; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

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

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

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

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

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

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

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