Cody

Solution 2027759

Submitted on 19 Nov 2019 at 15:57 by Audrey Guillet
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 = 1881;y_correct = 30; assert(isequal(yearraey(x),y_correct))

bx = '11101011001' nypb = '11101110111' nyp = 1911 y = 30

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

bx = '11111011110' y = 1

3   Pass
x = 2015;y_correct = 0; assert(isequal(yearraey(x),y_correct))

bx = '11111011111' y = 0

4   Pass
x = 606;y_correct = 27; assert(isequal(yearraey(x),y_correct))

bx = '1001011110' nypb = '1001111001' nyp = 633 y = 27

5   Pass
x = 6006;y_correct = 71; assert(isequal(yearraey(x),y_correct))

bx = '1011101110110' nypb = '1011110111101' nyp = 6077 y = 71

6   Pass
x = 60006;y_correct = 369; assert(isequal(yearraey(x),y_correct))

bx = '1110101001100110' nypb = '1110101111010111' nyp = 60375 y = 369

7   Pass
k=zeros(1,15); for n=1:15 y=2^n+2; k(n)=yearraey(y); end y_correct=[1 1 5 3 11 7 23 15 47 31 95 63 191 127 383]; assert(isequal(k,y_correct))

bx = '100' y = 1 bx = '110' y = 1 bx = '1010' nypb = '1111' nyp = 15 y = 5 bx = '10010' nypb = '10101' nyp = 21 y = 3 bx = '100010' nypb = '101101' nyp = 45 y = 11 bx = '1000010' nypb = '1001001' nyp = 73 y = 7 bx = '10000010' nypb = '10011001' nyp = 153 y = 23 bx = '100000010' nypb = '100010001' nyp = 273 y = 15 bx = '1000000010' nypb = '1000110001' nyp = 561 y = 47 bx = '10000000010' nypb = '10000100001' nyp = 1057 y = 31 bx = '100000000010' nypb = '100001100001' nyp = 2145 y = 95 bx = '1000000000010' nypb = '1000001000001' nyp = 4161 y = 63 bx = '10000000000010' nypb = '10000011000001' nyp = 8385 y = 191 bx = '100000000000010' nypb = '100000010000001' nyp = 16513 y = 127 bx = '1000000000000010' nypb = '1000000110000001' nyp = 33153 y = 383