Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Code Input and Output
p = 10;
assert(isequal(max_product(p),[4 39.0625]))
p = 29;
assert(isequal(max_product(p),[11 4.276204243443044e+04]))
p = 49;
assert(isequal(max_product(p),[18 6.739448339947788e+07]))
p = 256;
assert(isequal(max_product(p),[94 7.953137683223010e+40]))
p = 1000000;
assert(isequal(max_product(p),[367879 Inf]))