Cody

# Problem 2869. There are 10 types of people in the world

Solution 3908278

Submitted on 29 Nov 2020 by mahesh kumar
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))

a = '11101011001' x = 1882 a = '11101011010' x = 1883 a = '11101011011' x = 1884 a = '11101011100' x = 1885 a = '11101011101' x = 1886 a = '11101011110' x = 1887 a = '11101011111' x = 1888 a = '11101100000' x = 1889 a = '11101100001' x = 1890 a = '11101100010' x = 1891 a = '11101100011' x = 1892 a = '11101100100' x = 1893 a = '11101100101' x = 1894 a = '11101100110' x = 1895 a = '11101100111' x = 1896 a = '11101101000' x = 1897 a = '11101101001' x = 1898 a = '11101101010' x = 1899 a = '11101101011' x = 1900 a = '11101101100' x = 1901 a = '11101101101' x = 1902 a = '11101101110' x = 1903 a = '11101101111' x = 1904 a = '11101110000' x = 1905 a = '11101110001' x = 1906 a = '11101110010' x = 1907 a = '11101110011' x = 1908 a = '11101110100' x = 1909 a = '11101110101' x = 1910 a = '11101110110' x = 1911 a = '11101110111' y = 30

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

a = '11111011110' x = 2015 a = '11111011111' y = 1

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

a = '11111011111' y = 0

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

a = '1001011110' x = 607 a = '1001011111' x = 608 a = '1001100000' x = 609 a = '1001100001' x = 610 a = '1001100010' x = 611 a = '1001100011' x = 612 a = '1001100100' x = 613 a = '1001100101' x = 614 a = '1001100110' x = 615 a = '1001100111' x = 616 a = '1001101000' x = 617 a = '1001101001' x = 618 a = '1001101010' x = 619 a = '1001101011' x = 620 a = '1001101100' x = 621 a = '1001101101' x = 622 a = '1001101110' x = 623 a = '1001101111' x = 624 a = '1001110000' x = 625 a = '1001110001' x = 626 a = '1001110010' x = 627 a = '1001110011' x = 628 a = '1001110100' x = 629 a = '1001110101' x = 630 a = '1001110110' x = 631 a = '1001110111' x = 632 a = '1001111000' x = 633 a = '1001111001' y = 27

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

a = '1011101110110' x = 6007 a = '1011101110111' x = 6008 a = '1011101111000' x = 6009 a = '1011101111001' x = 6010 a = '1011101111010' x = 6011 a = '1011101111011' x = 6012 a = '1011101111100' x = 6013 a = '1011101111101' x = 6014 a = '1011101111110' x = 6015 a = '1011101111111' x = 6016 a = '1011110000000' x = 6017 a = '1011110000001' x = 6018 a = '1011110000010' x = 6019 a = '1011110000011' x = 6020 a = '1011110000100' x = 6021 a = '1011110000101' x = 6022 a = '1011110000110' x = 6023 a = '1011110000111' x = 6024 a = '1011110001000' x = 6025 a = '1011110001001' x = 6026 a = '1011110001010' x = 6027 a = '1011110001011' x = 6028 a = '1011110001100' x = 6029 a = '1011110001101' x = 6030 a = '1011110001110' x = 6031 a = '1011110001111' x = 6032 a = '1011110010000' x = 6033 a = '1011110010001' x = 6034 a = '1011110010010' x = 6035 a = '1011110010011' x = 6036 a = '1011110010100' x = 6037 a = '1011110010101' x = 6038 a = '1011110010110' x = 6039 a = '1011110010111' x = 6040 a = '1011110011000' x = 6041 a = '1011110011001' x = 6042 a = '1011110011010' x = 6043 a = '1011110011011' x = 6044 a = '1011110011100' x = 6045 a = '1011110011101' x = 6046 a = '1011110011110' x = 6047 a = '1011110011111' x = 6048 a = '1011110100000' x = 6049 a = '1011110100001' x = 6050 a = '1011110100010' x = 6051 a = '1011110100011' x = 6052 a = '1011110100100' x = 6053 a = '1011110100101' x = 6054 a = '1011110100110' x = 6055 a = '1011110100111' x = 6056 a = '1011110101000' x = 6057 a = '1011110101001' x = 6058 a = '1011110101010' x = 6059 a = '1011110101011' x = 6060 a = '1011110101100' x = 6061 a = '1011110101101' x = 6062 a = '1011110101110' x = 6063 a = '1011110101111' x = 6064 a = '1011110110000' x = 6065 a = '1011110110001' x = 6066 a = '1011110110010' x = 6067 a = '1011110110011' x = 6068 a = '1011110110100' x = 6069 a = '1011110110101' x = 6070 a = '1011110110110' x = 6071 a = '1011110110111' x = 6072 a = '1011110111000' x = 6073 a = '1011110111001' x = 6074 a = '1011110111010' x = 6075 a = '1011110111011' x = 6076 a = '1011110111100' x = 6077 a = '1011110111101' y = 71

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

a = '1110101001100110' x = 60007 a = '1110101001100111' x = 60008 a = '1110101001101000' x = 60009 a = '1110101001101001' x = 60010 a = '1110101001101010' x = 60011 a = '1110101001101011' x = 60012 a = '1110101001101100' x = 60013 a = '1110101001101101' x = 60014 a = '1110101001101110' x = 60015 a = '1110101001101111' x = 60016 a = '1110101001110000' x = 60017 a = '1110101001110001' x = 60018 a = '1110101001110010' x = 60019 a = '1110101001110011' x = 60020 a = '1110101001110100' x = 60021 a = '1110101001110101' x = 60022 a = '1110101001110110' x = 60023 a = '1110101001110111' x = 60024 a = '1110101001111000' x = 60025 a = '1110101001111001' x = 60026 a = '1110101001111010' x = 60027 a = '1110101001111011' x = 60028 a = '1110101001111100' x = 60029 a = '1110101001111101' x = 60030 a = '1110101001111110' x = 60031 a = '1110101001111111' x = 60032 a = '1110101010000000' x = 60033 a = '1110101010000001' x = 60034 a = '1110101010000010' x = 60035 a = '1110101010000011' x = 60036 a = '1110101010000100' x = 60037 a = '1110101010000101' x = 60038 a = '1110101010000110' x = 60039 a = '1110101010000111' x = 60040 a = '1110101010001000' x = 60041 a = '1110101010001001' x = 60042 a = '1110101010001010' x = 60043 a = '1110101010001011' x = 60044 a = '1110101010001100' x = 60045 a = '1110101010001101' x = 60046 a = '1110101010001110' x = 60047 a = '1110101010001111' x = 60048 a = '1110101010010000' x = 60049 a = '1110101010010001' x = 60050 a = '1110101010010010' x = 60051 a = '1110101010010011' x = 60052 a = '1110101010010100' x = 60053 a = '1110101010010101' x = 60054 a = '1110101010010110' x = 60055 a = '1110101010010111' x = 60056 a = '1110101010011000' x = 60057 a = '1110101010011001' x = 60058 a = '1110101010011010' x = 60059 a = '1110101010011011' x = 60060 a = '1110101010011100' x = 60061 a = '1110101010011101' x = 60062 a = '1110101010011110' x = 60063 a = '1110101010011111' x = 60064 a = '1110101010100000' x = 60065 a = '1110101010100001' x = 60066 a = '1110101010100010' x = 60067 a = '1110101010100011' x = 60068 a = '1110101010100100' x = 60069 a = '1110101010100101' x = 60070 a = '1110101010100110' x = 60071 a = '1110101010100111' x = 60072 a = '1110101010101000' x = 60073 a = '1110101010101001' x = 60074 a = '1110101010101010' x = 60075 a = '1110101010101011' x = 60076 a = '1110101010101100' x = 60077 a = '1110101010101101' x = 60078 a = '1110101010101110' x = 60079 a = '1110101010101111' x = 60080 a = '1110101010110000' x = 60081 a = '1110101010110001' x = 60082 a = '1110101010110010' x = 60083 a = '1110101010110011' x = 60084 a = '1110101010110100' x = 60085 a = '1110101010110101' x = 60086 a = '1110101010110110' x = 60087 a = '1110101010110111' x = 60088 a = '1110101010111000' x = 60089 a = '1110101010111001' x = 60090 a = '1110101010111010' x = 60091 a = '1110101010111011' x = 60092 a = '1110101010111100' x = 60093 a = '1110101010111101' x = 60094 a = '1110101010111110' x = 60095 a = '1110101010111111' x = 60096 a = '1110101011000000' x = 60097 a = '1110101011000001' x = 60098 a = '1110101011000010' x = 60099 a = '1110101011000011' x = 60100 a = '1110101011000100' x = 60101 a = '1110101011000101' x = 60102 a = '1110101011000110' x = 60103 a = '1110101011000111' x = 60104 a = '1110101011001000' x = 60105 a = '1110101011001001' x = 60106 a = '1110101011001010' x = 60107 a = '1110101011001011' x = 60108 a = '1110101011001100' x = 60109 a = '1110101011001101' x = 60110 a = '1110101011001110' x = 60111 a = '1110101011001111' x = 60112 a = '1110101011010000' x = 60113 a = '1110101011010001' x = 60114 a = '1110101011010010' x = 60115 a = '1110101011010011' x = 60116 a = '1110101011010100' x = 60117 a = '1110101011010101' x = 60118 a = '1110101011010110' x = 60119 a = '1110101011010111' x = 60120 a = '1110101011011000' x = 60121 a = '1110101011011001' x = 60122 a = '1110101011011010' x = 60123 a = '1110101011011011' x = 60124 a = '1110101011011100' x = 60125 a = '1110101011011101' x = 60126 a = '1110101011011110' x = 60127 a = '1110101011011111' x = 60128 a = '1110101011100000' x = 60129 a = '1110101011100001' x = 60130 a = '1110101011100010' x = 60131 a = '1110101011100011' x = 60132 a = '1110101011100100' x = 60133 a = '1110101011100101' x = 60134 a = '1110101011100110' x = 60135 a = '1110101011100111' x = 60136 a = '1110101011101000' x = 60137 a = '1110101011101001' x = 60138 a = '1110101011101010' x = 60139 a = '1110101011101011' x = 60140 a = '1110101011101100' x = 60141 a = '1110101011101101' x = 60142 a = '1110101011101110' x = 60143 a = '1110101011101111' x = 60144 a = '1110101011110000' x = 60145 a = '1110101011110001' x = 60146 a = '1110101011110010' x = 60147 a = '1110101011110011' x = 60148 a = '1110101011110100' x = 60149 a = '1110101011110101' x = 60150 a = '1110101011110110' x = 60151 a = '1110101011110111' x = 60152 a = '1110101011111000' x = 60153 a = '1110101011111001' x = 60154 a = '1110101011111010' x = 60155 a = '1110101011111011' x = 60156 a = '1110101011111100' x = 60157 a = '1110101011111101' x = 60158 a = '1110101011111110' x = 60159 a = '1110101011111111' x = 60160 a = '1110101100000000' x = 60161 a = '1110101100000001' x = 60162 a = '1110101100000010' x = 60163 a = '1110101100000011' x = 60164 a = '1110101100000100' x = 60165 a = '1110101100000101' x = 60166 a = '1110101100000110' x = 60167 a = '1110101100000111' x = 60168 a = '1110101100001000' x = 60169 a = '1110101100001001' x = 60170 a = '1110101100001010' x = 60171 a = '1110101100001011' x = 60172 a = '1110101100001100' x = 60173 a = '1110101100001101' x = 60174 a = '1110101100001110' x = 60175 a = '1110101100001111' x = 60176 a = '1110101100010000' x = 60177 a = '1110101100010001' x = 60178 a = '1110101100010010' x = 60179 a = '1110101100010011' x = 60180 a = '1110101100010100' x = 60181 a = '1110101100010101' x = 60182 a = '1110101100010110' x = 60183 a = '1110101100010111' x = 60184 a = '1110101100011000' x = 60185 a = '1110101100011001' x = 60186 a = '1110101100011010' x = 60187 a = '1110101100011011' x = 60188 a = '1110101100011100' x = 60189 a = '1110101100011101' x = 60190 a = '1110101100011110' x = 60191 a = '1110101100011111' x = 60192 a = '1110101100100000' x = 60193 a = '1110101100100001' x = 60194 a = '1110101100100010' x = 60195 a = '1110101100100011' x = 60196 a = '1110101100100100' x = 60197 a = '1110101100100101' x = 60198 a = '1110101100100110' x = 60199 a = '1110101100100111' x = 60200 a = '1110101100101000' x = 60201 a = '1110101100101001' x = 60202 a = '1110101100101010' x = 60203 a = '1110101100101011' x = 60204 a = '1110101100101100' x = 60205 a = '1110101100101101' x = 60206 ...

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))

a = '100' x = 5 a = '101' y = 1 a = '110' x = 7 a = '111' y = 1 a = '1010' x = 11 a = '1011' x = 12 a = '1100' x = 13 a = '1101' x = 14 a = '1110' x = 15 a = '1111' y = 5 a = '10010' x = 19 a = '10011' x = 20 a = '10100' x = 21 a = '10101' y = 3 a = '100010' x = 35 a = '100011' x = 36 a = '100100' x = 37 a = '100101' x = 38 a = '100110' x = 39 a = '100111' x = 40 a = '101000' x = 41 a = '101001' x = 42 a = '101010' x = 43 a = '101011' x = 44 a = '101100' x = 45 a = '101101' y = 11 a = '1000010' x = 67 a = '1000011' x = 68 a = '1000100' x = 69 a = '1000101' x = 70 a = '1000110' x = 71 a = '1000111' x = 72 a = '1001000' x = 73 a = '1001001' y = 7 a = '10000010' x = 131 a = '10000011' x = 132 a = '10000100' x = 133 a = '10000101' x = 134 a = '10000110' x = 135 a = '10000111' x = 136 a = '10001000' x = 137 a = '10001001' x = 138 a = '10001010' x = 139 a = '10001011' x = 140 a = '10001100' x = 141 a = '10001101' x = 142 a = '10001110' x = 143 a = '10001111' x = 144 a = '10010000' x = 145 a = '10010001' x = 146 a = '10010010' x = 147 a = '10010011' x = 148 a = '10010100' x = 149 a = '10010101' x = 150 a = '10010110' x = 151 a = '10010111' x = 152 a = '10011000' x = 153 a = '10011001' y = 23 a = '100000010' x = 259 a = '100000011' x = 260 a = '100000100' x = 261 a = '100000101' x = 262 a = '100000110' x = 263 a = '100000111' x = 264 a = '100001000' x = 265 a = '100001001' x = 266 a = '100001010' x = 267 a = '100001011' x = 268 a = '100001100' x = 269 a = '100001101' x = 270 a = '100001110' x = 271 a = '100001111' x = 272 a = '100010000' x = 273 a = '100010001' y = 15 a = '1000000010' x = 515 a = '1000000011' x = 516 a = '1000000100' x = 517 a = '1000000101' x = 518 a = '1000000110' x = 519 a = '1000000111' x = 520 a = '1000001000' x = 521 a = '1000001001' x = 522 a = '1000001010' x = 523 a = '1000001011' x = 524 a = '1000001100' x = 525 a = '1000001101' x = 526 a = '1000001110' x = 527 a = '1000001111' x = 528 a = '1000010000' x = 529 a = '1000010001' x = 530 a = '1000010010' x = 531 a = '1000010011' x = 532 a = '1000010100' x = 533 a = '1000010101' x = 534 a = '1000010110' x = 535 a = '1000010111' x = 536 a = '1000011000' x = 537 a = '1000011001' x = 538 a = '1000011010' x = 539 a = '1000011011' x = 540 a = '1000011100' x = 541 a = '1000011101' x = 542 a = '1000011110' x = 543 a = '1000011111' x = 544 a = '1000100000' x = 545 a = '1000100001' x = 546 a = '1000100010' x = 547 a = '1000100011' x = 548 a = '1000100100' x = 549 a = '1000100101' x = 550 a = '1000100110' x = 551 a = '1000100111' x = 552 a = '1000101000' x = 553 a = '1000101001' x = 554 a = '1000101010' x = 555 a = '1000101011' x = 556 a = '1000101100' x = 557 a = '1000101101' x = 558 a = '1000101110' x = 559 a = '1000101111' x = 560 a = '1000110000' x = 561 a = '1000110001' y = 47 a = '10000000010' x = 1027 a = '10000000011' x = 1028 a = '10000000100' x = 1029 a = '10000000101' x = 1030 a = '10000000110' x = 1031 a = '10000000111' x = 1032 a = '10000001000' x = 1033 a = '10000001001' x = 1034 a = '10000001010' x = 1035 a = '10000001011' x = 1036 a = '10000001100' x = 1037 a = '10000001101' x = 1038 a = '10000001110' x = 1039 a = '10000001111' x = 1040 a = '10000010000' x = 1041 a = '10000010001' x = 1042 a = '10000010010' x = 1043 a = '10000010011' x = 1044 a = '10000010100' x = 1045 a = '10000010101' x = 1046 a = '10000010110' x = 1047 a = '10000010111' x = 1048 a = '10000011000' x = 1049 a = '10000011001' x = 1050 a = '10000011010' x = 1051 a = '10000011011' x = 1052 a = '10000011100' x = 1053 a = '10000011101' x = 1054 a = '10000011110' x = 1055 a = '10000011111' x = 1056 a = '10000100000' x = 1057 a = '10000100001' y = 31 a = '100000000010' x = 2051 a = '100000000011' x = 2052 a = '100000000100' x = 2053 a = '100000000101' x = 2054 a = '100000000110' x = 2055 a = '100000000111' x = 2056 a = '100000001000' x = 2057 a = '100000001001' x = 2058 a = '100000001010' x = 2059 a = '100000001011' x = 2060 a = '100000001100' x = 2061 a = '100000001101' x = 2062 a = '100000001110' x = 2063 a = '100000001111' x = 2064 a = '100000010000' x = 2065 a = '100000010001' x = 2066 a = '100000010010' x = 2067 a = '100000010011' x = 2068 a = '100000010100' x = 2069 a = '100000010101' x = 2070 a = '100000010110' x = 2071 a = '100000010111' x = 2072 a = '100000011000' x = 2073 a = '100000011001' x = 2074 a = '100000011010' x = 2075 a = '100000011011' x = 2076 a = '100000011100' x = 2077 a = '100000011101' x = 2078 a = '100000011110' x = 2079 a = '100000011111' x = 2080 a = '100000100000' x = 2081 a = '100000100001' x = 2082 a = '100000100010' x = 2083 a = '100000100011' x = 2084 a = '100000100100' x = 2085 a = '100000100101' x = 2086 a = '100000100110' x = 2087 a = '100000100111' x = 2088 a = '100000101000' x = 2089 a = '100000101001' x = 2090 a = '100000101010' x = 2091 a = '100000101011' x = 2092 a = '100000101100' x = 2093 a = '100000101101' x = 2094 a = '100000101110' x = 2095 a = '100000101111' x = 2096 a = '100000110000' x = 2097 a = '100000110001' x = 2098 a = '100000110010' x = 2099 a = '100000110011' x = 2100 a = '100000110100' x = 2101 a = '100000110101' x = 2102 a = '100000110110' x = 2103 a = '100000110111' x = 2104 a = '100000111000' x = 2105 a = '100000111001' x = 2106 a = '100000111010' x = 2107 a = '100000111011' x = 2108 a = '100000111100' x = 2109 a = '100000111101' x = 2110 a = '100000111110' x = 2111 a = '100000111111' x = 2112 a = '100001000000' x = 2113 a = '100001000001' x = 2114 a = '100001000010' x = 2115 a = '100001000011' x = 2116 a = '100001000100' x = 2117 a = '100001000101' x = 2118 a = '100001000110' x = 2119 a = '100001000111' x = 2120 a = '100001001000' x = 2121 a = '100001001001' x = 2122 a = '100001001010' x = 2123 a = '100001001011' x = 2124 a = '100001001100' x = 2125 a = '100001001101' x = 2126 a = '100001001110' x = 2127 a = '100001001111' x = 2128 a = '100001010000' x = 2129 a = '100001010001' x = 2130 a = '100001010010' x = 2131 a = '100001010011' x = 2132 a = '100001010100' x = 2133 a = '100001010101' x = 2134 a = '100001010110' x = 2135 a = '100001010111' x = 2136 a = '100001011000' x = 2137 a = '100001011001' x = 2138 a = '100001011010' x = 2139 a = '100001011011' x = 2140 a = '...

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!