Problem 44836. Iccanobif numbers 1

Solution 1888544

Submitted on 31 Jul 2019 by Gergely Patay
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
x = 1;y_correct = 1; assert(isequal(iccanobif(x),y_correct))

2   Pass
x = 9;y_correct = 124; assert(isequal(iccanobif(x),y_correct))

3   Pass
x = 43;y_correct=36181429034; assert(isequal(iccanobif(x),y_correct))

4   Pass
for flag=1:50 y(flag)=iccanobif(flag); end dy=diff(y); assert(isequal(max(dy(1:25))+min(dy(1:25)),250750)) assert(isequal(max(dy)+min(dy),19910139546138)) sdy=sign(dy); assert(isequal(sum(sdy==-1),8)) [m1,w1]=min(y(1:10)); [m2,w2]=min(y(11:20)); [m3,w3]=min(y(21:30)); [m4,w4]=min(y(31:40)); [m5,w5]=min(y(41:50)); assert(isequal([m1 m2 m3 m4 m5],[1 836 113815 106496242 21807674140])) assert(isequal(w1*w2*w3*w4*w5,15))

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!