Problem 44782. Highest powers in factorials

Solution 1966938

Submitted on 8 Oct 2019 by Sean Kavanagh
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
n=7;p=2;y=biggest_power(n,p) assert(isequal(y,12));

y = 12

2   Pass
n=30;p=4;y=biggest_power(n,p) assert(isequal(y,60480));

y = 60480

3   Pass
n=25;p=11;y=biggest_power(n,p) assert(isequal(y,4));

y = 4

4   Pass
n=1000;p=100;y=biggest_power(n,p) assert(isequal(y,7257600));

y = 7257600

5   Pass
s=0; p=10; for n=100:-1:20 s(n-19)=biggest_power(n,p); end assert(isequal(sum(s),79641800)); assert(isequal(numel(unique(s)),13)); assert(isequal(floor(mean(s)),983232));

6   Pass
n=100; s=0; for p=30:-1:10 s(p-9)=biggest_power(n,p); end assert(isequal(sum(s),14825664)); assert(isequal(numel(unique(s)),7)); assert(isequal(floor(mean(s)),705984));

Suggested Problems

More from this Author80

Community Treasure Hunt

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

Start Hunting!