Cody

Problem 252. Project Euler: Problem 16, Sums of Digits of Powers of Two

Solution 2547216

Submitted on 14 Jun 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 = 0; y_correct = 1; assert(isequal(pow2_sumofdigits(x),y_correct))

n = 0

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

n = 0

3   Pass
x = 15; y_correct = 26; assert(isequal(pow2_sumofdigits(x),y_correct))

n = 3276 n = 327 n = 32 n = 3 n = 0

4   Fail
x = 345; y_correct = 521; assert(isequal(pow2_sumofdigits(x),y_correct))

n = 7.1672e+102 n = 7.1672e+101 n = 7.1672e+100 n = 7.1672e+99 n = 7.1672e+98 n = 7.1672e+97 n = 7.1672e+96 n = 7.1672e+95 n = 7.1672e+94 n = 7.1672e+93 n = 7.1672e+92 n = 7.1672e+91 n = 7.1672e+90 n = 7.1672e+89 n = 7.1672e+88 n = 7.1672e+87 n = 7.1672e+86 n = 7.1672e+85 n = 7.1672e+84 n = 7.1672e+83 n = 7.1672e+82 n = 7.1672e+81 n = 7.1672e+80 n = 7.1672e+79 n = 7.1672e+78 n = 7.1672e+77 n = 7.1672e+76 n = 7.1672e+75 n = 7.1672e+74 n = 7.1672e+73 n = 7.1672e+72 n = 7.1672e+71 n = 7.1672e+70 n = 7.1672e+69 n = 7.1672e+68 n = 7.1672e+67 n = 7.1672e+66 n = 7.1672e+65 n = 7.1672e+64 n = 7.1672e+63 n = 7.1672e+62 n = 7.1672e+61 n = 7.1672e+60 n = 7.1672e+59 n = 7.1672e+58 n = 7.1672e+57 n = 7.1672e+56 n = 7.1672e+55 n = 7.1672e+54 n = 7.1672e+53 n = 7.1672e+52 n = 7.1672e+51 n = 7.1672e+50 n = 7.1672e+49 n = 7.1672e+48 n = 7.1672e+47 n = 7.1672e+46 n = 7.1672e+45 n = 7.1672e+44 n = 7.1672e+43 n = 7.1672e+42 n = 7.1672e+41 n = 7.1672e+40 n = 7.1672e+39 n = 7.1672e+38 n = 7.1672e+37 n = 7.1672e+36 n = 7.1672e+35 n = 7.1672e+34 n = 7.1672e+33 n = 7.1672e+32 n = 7.1672e+31 n = 7.1672e+30 n = 7.1672e+29 n = 7.1672e+28 n = 7.1672e+27 n = 7.1672e+26 n = 7.1672e+25 n = 7.1672e+24 n = 7.1672e+23 n = 7.1672e+22 n = 7.1672e+21 n = 7.1672e+20 n = 7.1672e+19 n = 7.1672e+18 n = 7.1672e+17 n = 7.1672e+16 n = 7.1672e+15 n = 7.1672e+14 n = 7.1672e+13 n = 7.1672e+12 n = 7.1672e+11 n = 7.1672e+10 n = 7.1672e+09 n = 716718317 n = 71671831 n = 7167183 n = 716718 n = 71671 n = 7167 n = 716 n = 71 n = 7 n = 0

Assertion failed.

5   Fail
x = 999; y_correct = 1367; assert(isequal(pow2_sumofdigits(x),y_correct))

n = 5.3575e+299 n = 5.3575e+298 n = 5.3575e+297 n = 5.3575e+296 n = 5.3575e+295 n = 5.3575e+294 n = 5.3575e+293 n = 5.3575e+292 n = 5.3575e+291 n = 5.3575e+290 n = 5.3575e+289 n = 5.3575e+288 n = 5.3575e+287 n = 5.3575e+286 n = 5.3575e+285 n = 5.3575e+284 n = 5.3575e+283 n = 5.3575e+282 n = 5.3575e+281 n = 5.3575e+280 n = 5.3575e+279 n = 5.3575e+278 n = 5.3575e+277 n = 5.3575e+276 n = 5.3575e+275 n = 5.3575e+274 n = 5.3575e+273 n = 5.3575e+272 n = 5.3575e+271 n = 5.3575e+270 n = 5.3575e+269 n = 5.3575e+268 n = 5.3575e+267 n = 5.3575e+266 n = 5.3575e+265 n = 5.3575e+264 n = 5.3575e+263 n = 5.3575e+262 n = 5.3575e+261 n = 5.3575e+260 n = 5.3575e+259 n = 5.3575e+258 n = 5.3575e+257 n = 5.3575e+256 n = 5.3575e+255 n = 5.3575e+254 n = 5.3575e+253 n = 5.3575e+252 n = 5.3575e+251 n = 5.3575e+250 n = 5.3575e+249 n = 5.3575e+248 n = 5.3575e+247 n = 5.3575e+246 n = 5.3575e+245 n = 5.3575e+244 n = 5.3575e+243 n = 5.3575e+242 n = 5.3575e+241 n = 5.3575e+240 n = 5.3575e+239 n = 5.3575e+238 n = 5.3575e+237 n = 5.3575e+236 n = 5.3575e+235 n = 5.3575e+234 n = 5.3575e+233 n = 5.3575e+232 n = 5.3575e+231 n = 5.3575e+230 n = 5.3575e+229 n = 5.3575e+228 n = 5.3575e+227 n = 5.3575e+226 n = 5.3575e+225 n = 5.3575e+224 n = 5.3575e+223 n = 5.3575e+222 n = 5.3575e+221 n = 5.3575e+220 n = 5.3575e+219 n = 5.3575e+218 n = 5.3575e+217 n = 5.3575e+216 n = 5.3575e+215 n = 5.3575e+214 n = 5.3575e+213 n = 5.3575e+212 n = 5.3575e+211 n = 5.3575e+210 n = 5.3575e+209 n = 5.3575e+208 n = 5.3575e+207 n = 5.3575e+206 n = 5.3575e+205 n = 5.3575e+204 n = 5.3575e+203 n = 5.3575e+202 n = 5.3575e+201 n = 5.3575e+200 n = 5.3575e+199 n = 5.3575e+198 n = 5.3575e+197 n = 5.3575e+196 n = 5.3575e+195 n = 5.3575e+194 n = 5.3575e+193 n = 5.3575e+192 n = 5.3575e+191 n = 5.3575e+190 n = 5.3575e+189 n = 5.3575e+188 n = 5.3575e+187 n = 5.3575e+186 n = 5.3575e+185 n = 5.3575e+184 n = 5.3575e+183 n = 5.3575e+182 n = 5.3575e+181 n = 5.3575e+180 n = 5.3575e+179 n = 5.3575e+178 n = 5.3575e+177 n = 5.3575e+176 n = 5.3575e+175 n = 5.3575e+174 n = 5.3575e+173 n = 5.3575e+172 n = 5.3575e+171 n = 5.3575e+170 n = 5.3575e+169 n = 5.3575e+168 n = 5.3575e+167 n = 5.3575e+166 n = 5.3575e+165 n = 5.3575e+164 n = 5.3575e+163 n = 5.3575e+162 n = 5.3575e+161 n = 5.3575e+160 n = 5.3575e+159 n = 5.3575e+158 n = 5.3575e+157 n = 5.3575e+156 n = 5.3575e+155 n = 5.3575e+154 n = 5.3575e+153 n = 5.3575e+152 n = 5.3575e+151 n = 5.3575e+150 n = 5.3575e+149 n = 5.3575e+148 n = 5.3575e+147 n = 5.3575e+146 n = 5.3575e+145 n = 5.3575e+144 n = 5.3575e+143 n = 5.3575e+142 n = 5.3575e+141 n = 5.3575e+140 n = 5.3575e+139 n = 5.3575e+138 n = 5.3575e+137 n = 5.3575e+136 n = 5.3575e+135 n = 5.3575e+134 n = 5.3575e+133 n = 5.3575e+132 n = 5.3575e+131 n = 5.3575e+130 n = 5.3575e+129 n = 5.3575e+128 n = 5.3575e+127 n = 5.3575e+126 n = 5.3575e+125 n = 5.3575e+124 n = 5.3575e+123 n = 5.3575e+122 n = 5.3575e+121 n = 5.3575e+120 n = 5.3575e+119 n = 5.3575e+118 n = 5.3575e+117 n = 5.3575e+116 n = 5.3575e+115 n = 5.3575e+114 n = 5.3575e+113 n = 5.3575e+112 n = 5.3575e+111 n = 5.3575e+110 n = 5.3575e+109 n = 5.3575e+108 n = 5.3575e+107 n = 5.3575e+106 n = 5.3575e+105 n = 5.3575e+104 n = 5.3575e+103 n = 5.3575e+102 n = 5.3575e+101 n = 5.3575e+100 n = 5.3575e+99 n = 5.3575e+98 n = 5.3575e+97 n = 5.3575e+96 n = 5.3575e+95 n = 5.3575e+94 n = 5.3575e+93 n = 5.3575e+92 n = 5.3575e+91 n = 5.3575e+90 n = 5.3575e+89 n = 5.3575e+88 n = 5.3575e+87 n = 5.3575e+86 n = 5.3575e+85 n = 5.3575e+84 n = 5.3575e+83 n = 5.3575e+82 n = 5.3575e+81 n = 5.3575e+80 n = 5.3575e+79 n = 5.3575e+78 n = 5.3575e+77 n = 5.3575e+76 n = 5.3575e+75 n = 5.3575e+74 n = 5.3575e+73 n = 5.3575e+72 n = 5.3575e+71 n = 5.3575e+70 n = 5.3575e+69 n = 5.3575e+68 n = 5.3575e+67 n = 5.3575e+66 n = 5.3575e+65 n = 5.3575e+64 n = 5.3575e+63 n = 5.3575e+62 n = 5.3575e+61 n = 5.3575e+60 n = 5.3575e+59 n = 5.3575e+58 n = 5.3575e+57 n = 5.3575e+56 n = 5.3575e+55 n = 5.3575e+54 n = 5.3575e+53 n = 5.3575e+52 n = 5.3575e+51 n = 5.3575e+50 n = 5.3575e+49 n = 5.3575e+48 n = 5.3575e+47 n = 5.3575e+46 n = 5.3575e+45 n = 5.3575e+44 n = 5.3575e+43 n = 5.3575e+42 n = 5.3575e+41 n = 5.3575e+40 n = 5.3575e+39 n = 5.3575e+38 n = 5.3575e+37 n = 5.3575e+36 n = 5.3575e+35 n = 5.3575e+34 n = 5.3575e+33 n = 5.3575e+32 n = 5.3575e+31 n = 5.3575e+30 n = 5.3575e+29 n = 5.3575e+28 n = 5.3575e+27 n = 5.3575e+26 n = 5.3575e+25 n = 5.3575e+24 n = 5.3575e+23 n = 5.3575e+22 n = 5.3575e+21 n = 5.3575e+20 n = 5.3575e+19 n = 5.3575e+18 n = 5.3575e+17 n = 5.3575e+16 n = 5.3575e+15 n = 5.3575e+14 n = 5.3575e+13 n = 5.3575e+12 n = 5.3575e+11 n = 5.3575e+10 n = 5.3575e+09 n = 535754303 n = 53575430 n = 5357543 n = 535754 n = 53575 n = 5357 n = 535 n = 53 n = 5 n = 0

Assertion failed.

6   Fail
x = 2000; y_correct = 2704; assert(isequal(pow2_sumofdigits(x),y_correct))

n = NaN

Assertion failed.