Problem 44782. Highest powers in factorials

Solution 1730459

Submitted on 19 Feb 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   Pass
n=7;p=2;y=biggest_power(n,p) assert(isequal(y,12));

y = 12

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

y = 7

Assertion failed.

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

y = 4

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

y = 1

Assertion failed.

5   Fail
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));

Assertion failed.

6   Fail
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));

Assertion failed.

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!