Cody

Problem 42460. The cake is a lie...

Solution 2848461

Submitted on 18 Aug 2020
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 = 0; assert(isequal(birthday_cake(x),y_correct))

2   Pass
x = 2;y_correct = 1; assert(isequal(birthday_cake(x),y_correct))

3   Pass
x = 4;y_correct = 2; assert(isequal(birthday_cake(x),y_correct))

4   Fail
x = 7;y_correct = 3; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

5   Fail
x = 12;y_correct = 4; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

6   Fail
x = 27;y_correct = 6; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

7   Fail
x = 127;y_correct = 9; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

8   Fail
x = 2015;y_correct = 23; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

9   Fail
x = 4060225;y_correct = 290; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

10   Fail
x = 1234567890;y_correct = 1950; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

11   Fail
x = 1362067890;y_correct = 2015; assert(isequal(birthday_cake(x),y_correct))

Assertion failed.

12   Fail
y=arrayfun(@(x) birthday_cake(x),1:1000); assert(isequal(sum(y),13965)) [x1,y1]=hist(y,unique(y)); [m1,m2]=max(x1); assert(isequal(m1,154)) assert(isequal(x1(isprime(x1)),[2 7 11 29 37 67 79 137]))

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!