Cody

Solution 1443954

Submitted on 19 Feb 2018 by Tim
  • Size: 14
  • This is the leading solution.
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   Pass
x = 7;y_correct = 3; assert(isequal(birthday_cake(x),y_correct))

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

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

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

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

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

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

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

12   Pass
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]))