Cody

# Problem 44747. Exponents in Factorials

Solution 1656983

Submitted on 23 Oct 2018 by Binbin Qi
• Size: 39
• This is the leading solution.
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))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!