Cody

Solution 1688316

Submitted on 7 Dec 2018 by Jean-Marie Sainthillier
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
assert(isequal(maxexp(5,2),3))

2   Pass
assert(isequal(maxexp(9,3),4))

3   Pass
assert(isequal(maxexp(10,14),1))

4   Pass
q=arrayfun(@(x) maxexp(x,13),2:12); assert(all(q==0))

5   Pass
assert(isequal(maxexp(67,2),64))

6   Pass
assert(isequal(maxexp(10,4),4))

7   Pass
s1=maxexp(100,3); s2=maxexp(200,5); assert(isequal(maxexp(s2,s1)-maxexp(s1,s2),maxexp(100,13)+1))

8   Pass
v=zeros(1,99); for a=2:100 v(a-1)=maxexp(100,a); end assert(isequal(sum(v==1),10)) assert(isequal(sum(find(v==2)),496)) assert(isequal(sum(v),1299)) assert(isequal(max(v)-min(v),96))

9   Pass
assert(isequal(maxexp(1e9, 2), 999999987))

10   Pass
assert(isequal(maxexp(1e9, 3), 499999993))

11   Pass
assert(isequal(maxexp(1e9-1, 100), 124999994))

12   Pass
assert(isequal(maxexp(1e9-11, 2*3*5*7), 166666660))

13   Pass
assert(isequal(maxexp(1e9-13, 97), 10416665))