Cody

Problem 44337. Sums of Distinct Powers

Solution 1389164

Submitted on 21 Dec 2017
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   Fail
base=4;nstart=2;nend=6;y_correct=62; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 10 v = 0 v = 4 y = 4 s = 11 v = 16 v = 80 y = 84 s = 100 v = 0 v = 0 v = 4096 y = 4180 s = 101 v = 16384 v = 16384 v = 278528 y = 282708 s = 110 v = 0 v = 4194304 v = 20971520 y = 21254228

Assertion failed.

2   Fail
base=5;nstart=1;nend=1000;y_correct=1193853250; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 1 v = 1 y = 1 s = 10 v = 0 v = 16 y = 17 s = 11 v = 64 v = 320 y = 337 s = 100 v = 0 v = 0 v = 16384 y = 16721 s = 101 v = 65536 v = 65536 v = 1114112 y = 1130833 s = 110 v = 0 v = 16777216 v = 83886080 y = 85016913 s = 111 v = 268435456 v = 1.3422e+09 v = 5.6371e+09 y = 5.7222e+09 s = 1000 v = 0 v = 0 v = 0 v = 1.0995e+12 y = 1.1052e+12 s = 1001 v = 4.3980e+12 v = 4.3980e+12 v = 4.3980e+12 v = 2.8587e+14 y = 2.8698e+14 s = 1010 v = 0 v = 4.5036e+15 v = 4.5036e+15 v = 7.6561e+16 y = 7.6848e+16 s = 1011 v = 2.8823e+17 v = 1.4412e+18 v = 1.4412e+18 v = 1.9888e+19 y = 1.9965e+19 s = 1100 v = 0 v = 0 v = 1.1806e+21 v = 5.9030e+21 y = 5.9229e+21 s = 1101 v = 1.8889e+22 v = 1.8889e+22 v = 3.2112e+23 v = 1.5300e+24 y = 1.5360e+24 s = 1110 v = 0 v = 1.9343e+25 v = 9.6714e+25 v = 4.0620e+26 y = 4.0774e+26 s = 1111 v = 1.2379e+27 v = 6.1897e+27 v = 2.5997e+28 v = 1.0522e+29 y = 1.0563e+29 s = 10000 v = 0 v = 0 v = 0 v = 0 v = 8.1130e+31 y = 8.1235e+31 s = 10001 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 8.3401e+34 y = 8.3483e+34 s = 10010 v = 0 v = 1.3292e+36 v = 1.3292e+36 v = 1.3292e+36 v = 8.6400e+37 y = 8.6483e+37 s = 10011 v = 3.4028e+38 v = 1.7014e+39 v = 1.7014e+39 v = 1.7014e+39 v = 8.8814e+40 y = 8.8900e+40 s = 10100 v = 0 v = 0 v = 5.5752e+42 v = 5.5752e+42 v = 9.4778e+43 y = 9.4867e+43 s = 10101 v = 3.5681e+44 v = 3.5681e+44 v = 6.0658e+45 v = 6.0658e+45 v = 9.7410e+46 y = 9.7505e+46 s = 10110 v = 0 v = 1.4615e+48 v = 7.3075e+48 v = 7.3075e+48 v = 1.0084e+50 y = 1.0094e+50 s = 10111 v = 3.7414e+50 v = 1.8707e+51 v = 7.8570e+51 v = 7.8570e+51 v = 1.0364e+53 y = 1.0374e+53 s = 11000 v = 0 v = 0 v = 0 v = 2.4520e+55 v = 1.2260e+56 y = 1.2270e+56 s = 11001 v = 3.9232e+56 v = 3.9232e+56 v = 3.9232e+56 v = 2.5501e+58 v = 1.2593e+59 y = 1.2606e+59 s = 11010 v = 0 v = 1.6069e+60 v = 1.6069e+60 v = 2.7318e+61 v = 1.3016e+62 y = 1.3029e+62 s = 11011 v = 4.1138e+62 v = 2.0569e+63 v = 2.0569e+63 v = 2.8385e+64 v = 1.3370e+65 y = 1.3383e+65 s = 11100 v = 0 v = 0 v = 6.7400e+66 v = 3.3700e+67 v = 1.4154e+68 y = 1.4167e+68 s = 11101 v = 4.3136e+68 v = 4.3136e+68 v = 7.3331e+69 v = 3.4940e+70 v = 1.4537e+71 y = 1.4551e+71 s = 11110 v = 0 v = 1.7668e+72 v = 8.8342e+72 v = 3.7104e+73 v = 1.5018e+74 y = 1.5033e+74 s = 11111 v = 4.5231e+74 v = 2.2616e+75 v = 9.4986e+75 v = 3.8447e+76 v = 1.5424e+77 y = 1.5439e+77 s = 100000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 4.7428e+80 y = 4.7444e+80 s = 100001 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.9446e+84 y = 1.9450e+84 s = 100010 v = 0 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 7.9883e+87 y = 7.9902e+87 s = 100011 v = 3.1829e+88 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 3.2752e+91 y = 3.2760e+91 s = 100100 v = 0 v = 0 v = 2.0859e+93 v = 2.0859e+93 v = 2.0859e+93 v = 1.3559e+95 y = 1.3562e+95 s = 100101 v = 5.3400e+95 v = 5.3400e+95 v = 9.0779e+96 v = 9.0779e+96 v = 9.0779e+96 v = 5.5589e+98 y = 5.5603e+98 s = 100110 v = 0 v = 8.7490e+99 v = 4.3745e+100 v = 4.3745e+100 v = 4.3745e+100 v = 2.2835e+102 y = 2.2840e+102 s = 100111 v = 8.9590e+102 v = 4.4795e+103 v = 1.8814e+104 v = 1.8814e+104 v = 1.8814e+104 v = 9.3621e+105 y = 9.3644e+105 s = 101000 v = 0 v = 0 v = 0 v = 2.3485e+108 v = 2.3485e+108 v = 3.9925e+109 y = 3.9935e+109 s = 101001 v = 1.5031e+110 v = 1.5031e+110 v = 1.5031e+110 v = 9.7699e+111 v = 9.7699e+111 v = 1.6368e+113 y = 1.6372e+113 s = 101010 v = 0 v = 2.4626e+114 v = 2.4626e+114 v = 4.1865e+115 v = 4.1865e+115 v = 6.7230e+116 y = 6.7246e+116 s = 101011 v = 2.5217e+117 v = 1.2609e+118 v = 1.2609e+118 v = 1.7400e+119 v = 1.7400e+119 v = 2.7562e+120 y = 2.7569e+120 s = 101100 v = 0 v = 0 v = 1.6526e+122 v = 8.2632e+122 v = 8.2632e+122 v = 1.1403e+124 y = 1.1406e+124 s = 101101 v = 4.2308e+124 v = 4.2308e+124 v = 7.1923e+125 v = 3.4269e+126 v = 3.4269e+126 v = 4.6750e+127 y = 4.6761e+127 s = 101110 v = 0 v = 6.9317e+128 v = 3.4658e+129 v = 1.4557e+130 v = 1.4557e+130 v = 1.9201e+131 y = 1.9205e+131 s = 101111 v = 7.0980e+131 v = 3.5490e+132 v = 1.4906e+133 v = 6.0333e+133 v = 6.0333e+133 v = 7.8717e+134 y = 7.8736e+134 s = 110000 v = 0 v = 0 v = 0 v = 0 v = 7.4428e+137 v = 3.7214e+138 y = 3.7222e+138 s = 110001 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 3.0605e+141 v = 1.5255e+142 y = 1.5259e+142 s = 110010 v = 0 v = 1.9511e+143 v = 1.9511e+143 v = 1.9511e+143 v = 1.2682e+145 v = 6.2630e+145 y = 6.2645e+145 s = 110011 v = 1.9979e+146 v = 9.9896e+146 v = 9.9896e+146 v = 9.9896e+146 v = 5.2146e+148 v = 2.5673e+149 y = 2.5680e+149 s = 110100 v = 0 v = 0 v = 1.3094e+151 v = 1.3094e+151 v = 2.2259e+152 v = 1.0606e+153 y = 1.0608e+153 s = 110101 v = 3.3520e+153 v = 3.3520e+153 v = 5.6983e+154 v = 5.6983e+154 v = 9.1508e+155 v = 4.3475e+156 y = 4.3485e+156 s = 110110 v = 0 v = 5.4918e+157 v = 2.7459e+158 v = 2.7459e+158 v = 3.7894e+159 v = 1.7848e+160 y = 1.7853e+160 s = 110111 v = 5.6236e+160 v = 2.8118e+161 v = 1.1810e+162 v = 1.1810e+162 v = 1.5577e+163 v = 7.3164e+163 y = 7.3181e+163 s = 111000 v = 0 v = 0 v = 0 v = 1.4742e+166 v = 7.3710e+166 v = 3.0958e+167 y = 3.0966e+167 s = 111001 v = 9.4349e+167 v = 9.4349e+167 v = 9.4349e+167 v = 6.1327e+169 v = 3.0286e+170 v = 1.2690e+171 y = 1.2693e+171 s = 111010 v = 0 v = 1.5458e+172 v = 1.5458e+172 v = 2.6279e+173 v = 1.2521e+174 v = 5.2094e+174 y = 5.2107e+174 s = 111011 v = 1.5829e+175 v = 7.9146e+175 v = 7.9146e+175 v = 1.0922e+177 v = 5.1445e+177 v = 2.1354e+178 y = 2.1359e+178 s = 111100 v = 0 v = 0 v = 1.0374e+180 v = 5.1869e+180 v = 2.1785e+181 v = 8.8177e+181 y = 8.8199e+181 s = 111101 v = 2.6557e+182 v = 2.6557e+182 v = 4.5147e+183 v = 2.1511e+184 v = 8.9497e+184 v = 3.6144e+185 y = 3.6153e+185 s = 111110 v = 0 v = 4.3511e+186 v = 2.1755e+187 v = 9.1373e+187 v = 3.6984e+188 v = 1.4837e+189 y = 1.4841e+189 s = 111111 v = 4.4555e+189 v = 2.2278e+190 v = 9.3566e+190 v = 3.7872e+191 v = 1.5193e+192 v = 6.0818e+192 y = 6.0833e+192 s = 1000000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 0 v = 7.4751e+196 y = 7.4757e+196 s = 1000001 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 1.2250e+201 y = 1.2251e+201 s = 1000010 v = 0 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 2.0085e+205 y = 2.0087e+205 s = 1000011 v = 8.0263e+205 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 3.2916e+209 y = 3.2918e+209 s = 1000100 v = 0 v = 0 v = 2.1041e+211 v = 2.1041e+211 v = 2.1041e+211 v = 2.1041e+211 v = 5.4074e+213 y = 5.4077e+213 s = 1000101 v = 2.1546e+214 v = 2.1546e+214 v = 3.6627e+215 v = 3.6627e+215 v = 3.6627e+215 v = 3.6627e+215 v = 8.8617e+217 y = 8.8622e+217 s = 1000110 v = 0 v = 1.4120e+219 v = 7.0600e+219 v = 7.0600e+219 v = 7.0600e...

Assertion failed.

3   Fail
base=3;nstart=1;nend=1000;y_correct=14438162; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 1 v = 1 y = 1 s = 10 v = 0 v = 16 y = 17 s = 11 v = 64 v = 320 y = 337 s = 100 v = 0 v = 0 v = 16384 y = 16721 s = 101 v = 65536 v = 65536 v = 1114112 y = 1130833 s = 110 v = 0 v = 16777216 v = 83886080 y = 85016913 s = 111 v = 268435456 v = 1.3422e+09 v = 5.6371e+09 y = 5.7222e+09 s = 1000 v = 0 v = 0 v = 0 v = 1.0995e+12 y = 1.1052e+12 s = 1001 v = 4.3980e+12 v = 4.3980e+12 v = 4.3980e+12 v = 2.8587e+14 y = 2.8698e+14 s = 1010 v = 0 v = 4.5036e+15 v = 4.5036e+15 v = 7.6561e+16 y = 7.6848e+16 s = 1011 v = 2.8823e+17 v = 1.4412e+18 v = 1.4412e+18 v = 1.9888e+19 y = 1.9965e+19 s = 1100 v = 0 v = 0 v = 1.1806e+21 v = 5.9030e+21 y = 5.9229e+21 s = 1101 v = 1.8889e+22 v = 1.8889e+22 v = 3.2112e+23 v = 1.5300e+24 y = 1.5360e+24 s = 1110 v = 0 v = 1.9343e+25 v = 9.6714e+25 v = 4.0620e+26 y = 4.0774e+26 s = 1111 v = 1.2379e+27 v = 6.1897e+27 v = 2.5997e+28 v = 1.0522e+29 y = 1.0563e+29 s = 10000 v = 0 v = 0 v = 0 v = 0 v = 8.1130e+31 y = 8.1235e+31 s = 10001 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 8.3401e+34 y = 8.3483e+34 s = 10010 v = 0 v = 1.3292e+36 v = 1.3292e+36 v = 1.3292e+36 v = 8.6400e+37 y = 8.6483e+37 s = 10011 v = 3.4028e+38 v = 1.7014e+39 v = 1.7014e+39 v = 1.7014e+39 v = 8.8814e+40 y = 8.8900e+40 s = 10100 v = 0 v = 0 v = 5.5752e+42 v = 5.5752e+42 v = 9.4778e+43 y = 9.4867e+43 s = 10101 v = 3.5681e+44 v = 3.5681e+44 v = 6.0658e+45 v = 6.0658e+45 v = 9.7410e+46 y = 9.7505e+46 s = 10110 v = 0 v = 1.4615e+48 v = 7.3075e+48 v = 7.3075e+48 v = 1.0084e+50 y = 1.0094e+50 s = 10111 v = 3.7414e+50 v = 1.8707e+51 v = 7.8570e+51 v = 7.8570e+51 v = 1.0364e+53 y = 1.0374e+53 s = 11000 v = 0 v = 0 v = 0 v = 2.4520e+55 v = 1.2260e+56 y = 1.2270e+56 s = 11001 v = 3.9232e+56 v = 3.9232e+56 v = 3.9232e+56 v = 2.5501e+58 v = 1.2593e+59 y = 1.2606e+59 s = 11010 v = 0 v = 1.6069e+60 v = 1.6069e+60 v = 2.7318e+61 v = 1.3016e+62 y = 1.3029e+62 s = 11011 v = 4.1138e+62 v = 2.0569e+63 v = 2.0569e+63 v = 2.8385e+64 v = 1.3370e+65 y = 1.3383e+65 s = 11100 v = 0 v = 0 v = 6.7400e+66 v = 3.3700e+67 v = 1.4154e+68 y = 1.4167e+68 s = 11101 v = 4.3136e+68 v = 4.3136e+68 v = 7.3331e+69 v = 3.4940e+70 v = 1.4537e+71 y = 1.4551e+71 s = 11110 v = 0 v = 1.7668e+72 v = 8.8342e+72 v = 3.7104e+73 v = 1.5018e+74 y = 1.5033e+74 s = 11111 v = 4.5231e+74 v = 2.2616e+75 v = 9.4986e+75 v = 3.8447e+76 v = 1.5424e+77 y = 1.5439e+77 s = 100000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 4.7428e+80 y = 4.7444e+80 s = 100001 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.9446e+84 y = 1.9450e+84 s = 100010 v = 0 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 7.9883e+87 y = 7.9902e+87 s = 100011 v = 3.1829e+88 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 3.2752e+91 y = 3.2760e+91 s = 100100 v = 0 v = 0 v = 2.0859e+93 v = 2.0859e+93 v = 2.0859e+93 v = 1.3559e+95 y = 1.3562e+95 s = 100101 v = 5.3400e+95 v = 5.3400e+95 v = 9.0779e+96 v = 9.0779e+96 v = 9.0779e+96 v = 5.5589e+98 y = 5.5603e+98 s = 100110 v = 0 v = 8.7490e+99 v = 4.3745e+100 v = 4.3745e+100 v = 4.3745e+100 v = 2.2835e+102 y = 2.2840e+102 s = 100111 v = 8.9590e+102 v = 4.4795e+103 v = 1.8814e+104 v = 1.8814e+104 v = 1.8814e+104 v = 9.3621e+105 y = 9.3644e+105 s = 101000 v = 0 v = 0 v = 0 v = 2.3485e+108 v = 2.3485e+108 v = 3.9925e+109 y = 3.9935e+109 s = 101001 v = 1.5031e+110 v = 1.5031e+110 v = 1.5031e+110 v = 9.7699e+111 v = 9.7699e+111 v = 1.6368e+113 y = 1.6372e+113 s = 101010 v = 0 v = 2.4626e+114 v = 2.4626e+114 v = 4.1865e+115 v = 4.1865e+115 v = 6.7230e+116 y = 6.7246e+116 s = 101011 v = 2.5217e+117 v = 1.2609e+118 v = 1.2609e+118 v = 1.7400e+119 v = 1.7400e+119 v = 2.7562e+120 y = 2.7569e+120 s = 101100 v = 0 v = 0 v = 1.6526e+122 v = 8.2632e+122 v = 8.2632e+122 v = 1.1403e+124 y = 1.1406e+124 s = 101101 v = 4.2308e+124 v = 4.2308e+124 v = 7.1923e+125 v = 3.4269e+126 v = 3.4269e+126 v = 4.6750e+127 y = 4.6761e+127 s = 101110 v = 0 v = 6.9317e+128 v = 3.4658e+129 v = 1.4557e+130 v = 1.4557e+130 v = 1.9201e+131 y = 1.9205e+131 s = 101111 v = 7.0980e+131 v = 3.5490e+132 v = 1.4906e+133 v = 6.0333e+133 v = 6.0333e+133 v = 7.8717e+134 y = 7.8736e+134 s = 110000 v = 0 v = 0 v = 0 v = 0 v = 7.4428e+137 v = 3.7214e+138 y = 3.7222e+138 s = 110001 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 3.0605e+141 v = 1.5255e+142 y = 1.5259e+142 s = 110010 v = 0 v = 1.9511e+143 v = 1.9511e+143 v = 1.9511e+143 v = 1.2682e+145 v = 6.2630e+145 y = 6.2645e+145 s = 110011 v = 1.9979e+146 v = 9.9896e+146 v = 9.9896e+146 v = 9.9896e+146 v = 5.2146e+148 v = 2.5673e+149 y = 2.5680e+149 s = 110100 v = 0 v = 0 v = 1.3094e+151 v = 1.3094e+151 v = 2.2259e+152 v = 1.0606e+153 y = 1.0608e+153 s = 110101 v = 3.3520e+153 v = 3.3520e+153 v = 5.6983e+154 v = 5.6983e+154 v = 9.1508e+155 v = 4.3475e+156 y = 4.3485e+156 s = 110110 v = 0 v = 5.4918e+157 v = 2.7459e+158 v = 2.7459e+158 v = 3.7894e+159 v = 1.7848e+160 y = 1.7853e+160 s = 110111 v = 5.6236e+160 v = 2.8118e+161 v = 1.1810e+162 v = 1.1810e+162 v = 1.5577e+163 v = 7.3164e+163 y = 7.3181e+163 s = 111000 v = 0 v = 0 v = 0 v = 1.4742e+166 v = 7.3710e+166 v = 3.0958e+167 y = 3.0966e+167 s = 111001 v = 9.4349e+167 v = 9.4349e+167 v = 9.4349e+167 v = 6.1327e+169 v = 3.0286e+170 v = 1.2690e+171 y = 1.2693e+171 s = 111010 v = 0 v = 1.5458e+172 v = 1.5458e+172 v = 2.6279e+173 v = 1.2521e+174 v = 5.2094e+174 y = 5.2107e+174 s = 111011 v = 1.5829e+175 v = 7.9146e+175 v = 7.9146e+175 v = 1.0922e+177 v = 5.1445e+177 v = 2.1354e+178 y = 2.1359e+178 s = 111100 v = 0 v = 0 v = 1.0374e+180 v = 5.1869e+180 v = 2.1785e+181 v = 8.8177e+181 y = 8.8199e+181 s = 111101 v = 2.6557e+182 v = 2.6557e+182 v = 4.5147e+183 v = 2.1511e+184 v = 8.9497e+184 v = 3.6144e+185 y = 3.6153e+185 s = 111110 v = 0 v = 4.3511e+186 v = 2.1755e+187 v = 9.1373e+187 v = 3.6984e+188 v = 1.4837e+189 y = 1.4841e+189 s = 111111 v = 4.4555e+189 v = 2.2278e+190 v = 9.3566e+190 v = 3.7872e+191 v = 1.5193e+192 v = 6.0818e+192 y = 6.0833e+192 s = 1000000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 0 v = 7.4751e+196 y = 7.4757e+196 s = 1000001 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 1.2250e+201 y = 1.2251e+201 s = 1000010 v = 0 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 2.0085e+205 y = 2.0087e+205 s = 1000011 v = 8.0263e+205 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 3.2916e+209 y = 3.2918e+209 s = 1000100 v = 0 v = 0 v = 2.1041e+211 v = 2.1041e+211 v = 2.1041e+211 v = 2.1041e+211 v = 5.4074e+213 y = 5.4077e+213 s = 1000101 v = 2.1546e+214 v = 2.1546e+214 v = 3.6627e+215 v = 3.6627e+215 v = 3.6627e+215 v = 3.6627e+215 v = 8.8617e+217 y = 8.8622e+217 s = 1000110 v = 0 v = 1.4120e+219 v = 7.0600e+219 v = 7.0600e+219 v = 7.0600e...

Assertion failed.

4   Fail
base=3;nstart=100;nend=1000;y_correct=14397354; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 1100100 v = 0 v = 0 v = 16 v = 16 v = 16 v = 1040 v = 5136 y = 5136 s = 1100101 v = 16384 v = 16384 v = 278528 v = 278528 v = 278528 v = 17055744 v = 84164608 y = 84169744 s = 1100110 v = 0 v = 1.0737e+09 v = 5.3687e+09 v = 5.3687e+09 v = 5.3687e+09 v = 2.8025e+11 v = 1.3798e+12 y = 1.3798e+12 s = 1100111 v = 4.3980e+12 v = 2.1990e+13 v = 9.2359e+13 v = 9.2359e+13 v = 9.2359e+13 v = 4.5960e+15 v = 2.2610e+16 y = 2.2612e+16 s = 1101000 v = 0 v = 0 v = 0 v = 4.6117e+18 v = 4.6117e+18 v = 7.8399e+19 v = 3.7355e+20 y = 3.7357e+20 s = 1101001 v = 1.1806e+21 v = 1.1806e+21 v = 1.1806e+21 v = 7.6738e+22 v = 7.6738e+22 v = 1.2857e+24 v = 6.1214e+24 y = 6.1217e+24 s = 1101010 v = 0 v = 7.7371e+25 v = 7.7371e+25 v = 1.3153e+27 v = 1.3153e+27 v = 2.1122e+28 v = 1.0035e+29 y = 1.0036e+29 s = 1101011 v = 3.1691e+29 v = 1.5846e+30 v = 1.5846e+30 v = 2.1867e+31 v = 2.1867e+31 v = 3.4639e+32 v = 1.6445e+33 y = 1.6446e+33 s = 1101100 v = 0 v = 0 v = 8.3077e+34 v = 4.1538e+35 v = 4.1538e+35 v = 5.7323e+36 v = 2.7000e+37 y = 2.7002e+37 s = 1101101 v = 8.5071e+37 v = 8.5071e+37 v = 1.4462e+39 v = 6.8907e+39 v = 6.8907e+39 v = 9.4003e+40 v = 4.4245e+41 y = 4.4248e+41 s = 1101110 v = 0 v = 5.5752e+42 v = 2.7876e+43 v = 1.1708e+44 v = 1.1708e+44 v = 1.5443e+45 v = 7.2533e+45 y = 7.2538e+45 s = 1101111 v = 2.2836e+46 v = 1.1418e+47 v = 4.7956e+47 v = 1.9411e+48 v = 1.9411e+48 v = 2.5325e+49 v = 1.1886e+50 y = 1.1887e+50 s = 1110000 v = 0 v = 0 v = 0 v = 0 v = 9.5781e+52 v = 4.7890e+53 v = 2.0114e+54 y = 2.0115e+54 s = 1110001 v = 6.1300e+54 v = 6.1300e+54 v = 6.1300e+54 v = 6.1300e+54 v = 1.5754e+57 v = 7.8525e+57 v = 3.2961e+58 y = 3.2963e+58 s = 1110010 v = 0 v = 4.0173e+59 v = 4.0173e+59 v = 4.0173e+59 v = 2.6113e+61 v = 1.2896e+62 v = 5.4033e+62 y = 5.4037e+62 s = 1110011 v = 1.6455e+63 v = 8.2275e+63 v = 8.2275e+63 v = 8.2275e+63 v = 4.2948e+65 v = 2.1145e+66 v = 8.8545e+66 y = 8.8550e+66 s = 1110100 v = 0 v = 0 v = 4.3136e+68 v = 4.3136e+68 v = 7.3331e+69 v = 3.4940e+70 v = 1.4537e+71 y = 1.4538e+71 s = 1110101 v = 4.4171e+71 v = 4.4171e+71 v = 7.5091e+72 v = 7.5091e+72 v = 1.2059e+74 v = 5.7290e+74 v = 2.3822e+75 y = 2.3823e+75 s = 1110110 v = 0 v = 2.8948e+76 v = 1.4474e+77 v = 1.4474e+77 v = 1.9974e+78 v = 9.4081e+78 v = 3.9051e+79 y = 3.9053e+79 s = 1110111 v = 1.1857e+80 v = 5.9286e+80 v = 2.4900e+81 v = 2.4900e+81 v = 3.2844e+82 v = 1.5426e+83 v = 6.3993e+83 y = 6.3997e+83 s = 1111000 v = 0 v = 0 v = 0 v = 1.2433e+86 v = 6.2165e+86 v = 2.6109e+87 v = 1.0568e+88 y = 1.0569e+88 s = 1111001 v = 3.1829e+88 v = 3.1829e+88 v = 3.1829e+88 v = 2.0689e+90 v = 1.0217e+91 v = 4.2810e+91 v = 1.7318e+92 y = 1.7319e+92 s = 1111010 v = 0 v = 2.0859e+93 v = 2.0859e+93 v = 3.5461e+94 v = 1.6896e+95 v = 7.0296e+95 v = 2.8389e+96 y = 2.8391e+96 s = 1111011 v = 8.5439e+96 v = 4.2720e+97 v = 4.2720e+97 v = 5.8953e+98 v = 2.7768e+99 v = 1.1526e+100 v = 4.6522e+100 y = 4.6525e+100 s = 1111100 v = 0 v = 0 v = 2.2397e+102 v = 1.1199e+103 v = 4.7035e+103 v = 1.9038e+104 v = 7.6375e+104 y = 7.6380e+104 s = 1111101 v = 2.2935e+105 v = 2.2935e+105 v = 3.8989e+106 v = 1.8577e+107 v = 7.7291e+107 v = 3.1215e+108 v = 1.2516e+109 y = 1.2516e+109 s = 1111110 v = 0 v = 1.5031e+110 v = 7.5153e+110 v = 3.1564e+111 v = 1.2776e+112 v = 5.1255e+112 v = 2.0517e+113 y = 2.0518e+113 s = 1111111 v = 6.1566e+113 v = 3.0783e+114 v = 1.2929e+115 v = 5.2331e+115 v = 2.0994e+116 v = 8.4037e+116 v = 3.3621e+117 y = 3.3623e+117 s = 10000000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 0 v = 0 v = 1.6526e+122 y = 1.6527e+122 s = 10000001 v = 6.6106e+122 v = 6.6106e+122 v = 6.6106e+122 v = 6.6106e+122 v = 6.6106e+122 v = 6.6106e+122 v = 6.6106e+122 v = 1.0831e+127 y = 1.0832e+127 s = 10000010 v = 0 v = 1.7329e+128 v = 1.7329e+128 v = 1.7329e+128 v = 1.7329e+128 v = 1.7329e+128 v = 1.7329e+128 v = 7.0998e+131 y = 7.0999e+131 s = 10000011 v = 2.8392e+132 v = 1.4196e+133 v = 1.4196e+133 v = 1.4196e+133 v = 1.4196e+133 v = 1.4196e+133 v = 1.4196e+133 v = 4.6532e+136 y = 4.6533e+136 s = 10000100 v = 0 v = 0 v = 2.9771e+138 v = 2.9771e+138 v = 2.9771e+138 v = 2.9771e+138 v = 2.9771e+138 v = 3.0516e+141 y = 3.0516e+141 s = 10000101 v = 1.2194e+142 v = 1.2194e+142 v = 2.0730e+143 v = 2.0730e+143 v = 2.0730e+143 v = 2.0730e+143 v = 2.0730e+143 v = 2.0000e+146 y = 2.0000e+146 s = 10000110 v = 0 v = 3.1967e+147 v = 1.5983e+148 v = 1.5983e+148 v = 1.5983e+148 v = 1.5983e+148 v = 1.5983e+148 v = 1.3110e+151 y = 1.3110e+151 s = 10000111 v = 5.2374e+151 v = 2.6187e+152 v = 1.0999e+153 v = 1.0999e+153 v = 1.0999e+153 v = 1.0999e+153 v = 1.0999e+153 v = 8.5920e+155 y = 8.5921e+155 s = 10001000 v = 0 v = 0 v = 0 v = 2.1967e+158 v = 2.1967e+158 v = 2.1967e+158 v = 2.1967e+158 v = 5.6456e+160 y = 5.6457e+160 s = 10001001 v = 2.2495e+161 v = 2.2495e+161 v = 2.2495e+161 v = 1.4621e+163 v = 1.4621e+163 v = 1.4621e+163 v = 1.4621e+163 v = 3.7001e+165 y = 3.7002e+165 s = 10001010 v = 0 v = 5.8968e+166 v = 5.8968e+166 v = 1.0025e+168 v = 1.0025e+168 v = 1.0025e+168 v = 1.0025e+168 v = 2.4254e+170 y = 2.4254e+170 s = 10001011 v = 9.6613e+170 v = 4.8307e+171 v = 4.8307e+171 v = 6.6663e+172 v = 6.6663e+172 v = 6.6663e+172 v = 6.6663e+172 v = 1.5896e+175 y = 1.5896e+175 s = 10001100 v = 0 v = 0 v = 1.0131e+177 v = 5.0653e+177 v = 5.0653e+177 v = 5.0653e+177 v = 5.0653e+177 v = 1.0424e+180 y = 1.0425e+180 s = 10001101 v = 4.1495e+180 v = 4.1495e+180 v = 7.0542e+181 v = 3.3611e+182 v = 3.3611e+182 v = 3.3611e+182 v = 3.3611e+182 v = 6.8322e+184 y = 6.8323e+184 s = 10001110 v = 0 v = 1.0878e+186 v = 5.4389e+186 v = 2.2843e+187 v = 2.2843e+187 v = 2.2843e+187 v = 2.2843e+187 v = 4.4784e+189 y = 4.4784e+189 s = 10001111 v = 1.7822e+190 v = 8.9110e+190 v = 3.7426e+191 v = 1.5149e+192 v = 1.5149e+192 v = 1.5149e+192 v = 1.5149e+192 v = 2.9351e+194 y = 2.9352e+194 s = 10010000 v = 0 v = 0 v = 0 v = 0 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 1.9435e+199 y = 1.9436e+199 s = 10010001 v = 7.6545e+199 v = 7.6545e+199 v = 7.6545e+199 v = 7.6545e+199 v = 1.9672e+202 v = 1.9672e+202 v = 1.9672e+202 v = 1.2738e+204 y = 1.2738e+204 s = 10010010 v = 0 v = 2.0066e+205 v = 2.0066e+205 v = 2.0066e+205 v = 1.3043e+207 v = 1.3043e+207 v = 1.3043e+207 v = 8.3494e+208 y = 8.3495e+208 s = 10010011 v = 3.2876e+209 v = 1.6438e+210 v = 1.6438e+210 v = 1.6438e+210 v = 8.5806e+211 v = 8.5806e+211 v = 8.5806e+211 v = 5.4722e+213 y = 5.4723e+213 s = 10010100 v = 0 v = 0 v = 3.4473e+215 v = 3.4473e+215 v = 5.8604e+216 v = 5.8604e+216 v = 5.8604e+216 v = 3.5886e+218 y = 3.5887e+218 s = 10010101 v = 1.4120e+219 v = 1.4120e+219 v = 2.4004e+220 v = 2.4004e+220 v = 3.8548e+221 v = 3.8548e+221 v = 3.8548e+221 v = 2.3520e+223 y = 2.3520e+223 s = 10010110 v = 0 v = 3.7015e+224 v = 1.8507e+225 v = 1.8507e+225 v = 2.5540e+226 v = 2.5540e+226 v = 2.5540e+226 v = 1.5417e+228 y = 1.5417e+228 s = 10010111 v = 6.0645e+228 v = 3.0323e+229 v = 1.2735e+230 v = 1.2735e+230 v = 1.6799e+231 v = 1.6799e+231 v = 1.6799e+231 v = 1.0104e+233 y = 1.0104e+233 s = 10011000 v = 0 v = 0 v = 0 v = 2.5436e+235 v = 1.2718e+236 v = ...

Assertion failed.

5   Fail
base=2;nstart=1;nend=2017;y_correct=2035153; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 1 v = 1 y = 1 s = 10 v = 0 v = 16 y = 17 s = 11 v = 64 v = 320 y = 337 s = 100 v = 0 v = 0 v = 16384 y = 16721 s = 101 v = 65536 v = 65536 v = 1114112 y = 1130833 s = 110 v = 0 v = 16777216 v = 83886080 y = 85016913 s = 111 v = 268435456 v = 1.3422e+09 v = 5.6371e+09 y = 5.7222e+09 s = 1000 v = 0 v = 0 v = 0 v = 1.0995e+12 y = 1.1052e+12 s = 1001 v = 4.3980e+12 v = 4.3980e+12 v = 4.3980e+12 v = 2.8587e+14 y = 2.8698e+14 s = 1010 v = 0 v = 4.5036e+15 v = 4.5036e+15 v = 7.6561e+16 y = 7.6848e+16 s = 1011 v = 2.8823e+17 v = 1.4412e+18 v = 1.4412e+18 v = 1.9888e+19 y = 1.9965e+19 s = 1100 v = 0 v = 0 v = 1.1806e+21 v = 5.9030e+21 y = 5.9229e+21 s = 1101 v = 1.8889e+22 v = 1.8889e+22 v = 3.2112e+23 v = 1.5300e+24 y = 1.5360e+24 s = 1110 v = 0 v = 1.9343e+25 v = 9.6714e+25 v = 4.0620e+26 y = 4.0774e+26 s = 1111 v = 1.2379e+27 v = 6.1897e+27 v = 2.5997e+28 v = 1.0522e+29 y = 1.0563e+29 s = 10000 v = 0 v = 0 v = 0 v = 0 v = 8.1130e+31 y = 8.1235e+31 s = 10001 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 8.3401e+34 y = 8.3483e+34 s = 10010 v = 0 v = 1.3292e+36 v = 1.3292e+36 v = 1.3292e+36 v = 8.6400e+37 y = 8.6483e+37 s = 10011 v = 3.4028e+38 v = 1.7014e+39 v = 1.7014e+39 v = 1.7014e+39 v = 8.8814e+40 y = 8.8900e+40 s = 10100 v = 0 v = 0 v = 5.5752e+42 v = 5.5752e+42 v = 9.4778e+43 y = 9.4867e+43 s = 10101 v = 3.5681e+44 v = 3.5681e+44 v = 6.0658e+45 v = 6.0658e+45 v = 9.7410e+46 y = 9.7505e+46 s = 10110 v = 0 v = 1.4615e+48 v = 7.3075e+48 v = 7.3075e+48 v = 1.0084e+50 y = 1.0094e+50 s = 10111 v = 3.7414e+50 v = 1.8707e+51 v = 7.8570e+51 v = 7.8570e+51 v = 1.0364e+53 y = 1.0374e+53 s = 11000 v = 0 v = 0 v = 0 v = 2.4520e+55 v = 1.2260e+56 y = 1.2270e+56 s = 11001 v = 3.9232e+56 v = 3.9232e+56 v = 3.9232e+56 v = 2.5501e+58 v = 1.2593e+59 y = 1.2606e+59 s = 11010 v = 0 v = 1.6069e+60 v = 1.6069e+60 v = 2.7318e+61 v = 1.3016e+62 y = 1.3029e+62 s = 11011 v = 4.1138e+62 v = 2.0569e+63 v = 2.0569e+63 v = 2.8385e+64 v = 1.3370e+65 y = 1.3383e+65 s = 11100 v = 0 v = 0 v = 6.7400e+66 v = 3.3700e+67 v = 1.4154e+68 y = 1.4167e+68 s = 11101 v = 4.3136e+68 v = 4.3136e+68 v = 7.3331e+69 v = 3.4940e+70 v = 1.4537e+71 y = 1.4551e+71 s = 11110 v = 0 v = 1.7668e+72 v = 8.8342e+72 v = 3.7104e+73 v = 1.5018e+74 y = 1.5033e+74 s = 11111 v = 4.5231e+74 v = 2.2616e+75 v = 9.4986e+75 v = 3.8447e+76 v = 1.5424e+77 y = 1.5439e+77 s = 100000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 4.7428e+80 y = 4.7444e+80 s = 100001 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.9446e+84 y = 1.9450e+84 s = 100010 v = 0 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 7.9883e+87 y = 7.9902e+87 s = 100011 v = 3.1829e+88 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 3.2752e+91 y = 3.2760e+91 s = 100100 v = 0 v = 0 v = 2.0859e+93 v = 2.0859e+93 v = 2.0859e+93 v = 1.3559e+95 y = 1.3562e+95 s = 100101 v = 5.3400e+95 v = 5.3400e+95 v = 9.0779e+96 v = 9.0779e+96 v = 9.0779e+96 v = 5.5589e+98 y = 5.5603e+98 s = 100110 v = 0 v = 8.7490e+99 v = 4.3745e+100 v = 4.3745e+100 v = 4.3745e+100 v = 2.2835e+102 y = 2.2840e+102 s = 100111 v = 8.9590e+102 v = 4.4795e+103 v = 1.8814e+104 v = 1.8814e+104 v = 1.8814e+104 v = 9.3621e+105 y = 9.3644e+105 s = 101000 v = 0 v = 0 v = 0 v = 2.3485e+108 v = 2.3485e+108 v = 3.9925e+109 y = 3.9935e+109 s = 101001 v = 1.5031e+110 v = 1.5031e+110 v = 1.5031e+110 v = 9.7699e+111 v = 9.7699e+111 v = 1.6368e+113 y = 1.6372e+113 s = 101010 v = 0 v = 2.4626e+114 v = 2.4626e+114 v = 4.1865e+115 v = 4.1865e+115 v = 6.7230e+116 y = 6.7246e+116 s = 101011 v = 2.5217e+117 v = 1.2609e+118 v = 1.2609e+118 v = 1.7400e+119 v = 1.7400e+119 v = 2.7562e+120 y = 2.7569e+120 s = 101100 v = 0 v = 0 v = 1.6526e+122 v = 8.2632e+122 v = 8.2632e+122 v = 1.1403e+124 y = 1.1406e+124 s = 101101 v = 4.2308e+124 v = 4.2308e+124 v = 7.1923e+125 v = 3.4269e+126 v = 3.4269e+126 v = 4.6750e+127 y = 4.6761e+127 s = 101110 v = 0 v = 6.9317e+128 v = 3.4658e+129 v = 1.4557e+130 v = 1.4557e+130 v = 1.9201e+131 y = 1.9205e+131 s = 101111 v = 7.0980e+131 v = 3.5490e+132 v = 1.4906e+133 v = 6.0333e+133 v = 6.0333e+133 v = 7.8717e+134 y = 7.8736e+134 s = 110000 v = 0 v = 0 v = 0 v = 0 v = 7.4428e+137 v = 3.7214e+138 y = 3.7222e+138 s = 110001 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 3.0605e+141 v = 1.5255e+142 y = 1.5259e+142 s = 110010 v = 0 v = 1.9511e+143 v = 1.9511e+143 v = 1.9511e+143 v = 1.2682e+145 v = 6.2630e+145 y = 6.2645e+145 s = 110011 v = 1.9979e+146 v = 9.9896e+146 v = 9.9896e+146 v = 9.9896e+146 v = 5.2146e+148 v = 2.5673e+149 y = 2.5680e+149 s = 110100 v = 0 v = 0 v = 1.3094e+151 v = 1.3094e+151 v = 2.2259e+152 v = 1.0606e+153 y = 1.0608e+153 s = 110101 v = 3.3520e+153 v = 3.3520e+153 v = 5.6983e+154 v = 5.6983e+154 v = 9.1508e+155 v = 4.3475e+156 y = 4.3485e+156 s = 110110 v = 0 v = 5.4918e+157 v = 2.7459e+158 v = 2.7459e+158 v = 3.7894e+159 v = 1.7848e+160 y = 1.7853e+160 s = 110111 v = 5.6236e+160 v = 2.8118e+161 v = 1.1810e+162 v = 1.1810e+162 v = 1.5577e+163 v = 7.3164e+163 y = 7.3181e+163 s = 111000 v = 0 v = 0 v = 0 v = 1.4742e+166 v = 7.3710e+166 v = 3.0958e+167 y = 3.0966e+167 s = 111001 v = 9.4349e+167 v = 9.4349e+167 v = 9.4349e+167 v = 6.1327e+169 v = 3.0286e+170 v = 1.2690e+171 y = 1.2693e+171 s = 111010 v = 0 v = 1.5458e+172 v = 1.5458e+172 v = 2.6279e+173 v = 1.2521e+174 v = 5.2094e+174 y = 5.2107e+174 s = 111011 v = 1.5829e+175 v = 7.9146e+175 v = 7.9146e+175 v = 1.0922e+177 v = 5.1445e+177 v = 2.1354e+178 y = 2.1359e+178 s = 111100 v = 0 v = 0 v = 1.0374e+180 v = 5.1869e+180 v = 2.1785e+181 v = 8.8177e+181 y = 8.8199e+181 s = 111101 v = 2.6557e+182 v = 2.6557e+182 v = 4.5147e+183 v = 2.1511e+184 v = 8.9497e+184 v = 3.6144e+185 y = 3.6153e+185 s = 111110 v = 0 v = 4.3511e+186 v = 2.1755e+187 v = 9.1373e+187 v = 3.6984e+188 v = 1.4837e+189 y = 1.4841e+189 s = 111111 v = 4.4555e+189 v = 2.2278e+190 v = 9.3566e+190 v = 3.7872e+191 v = 1.5193e+192 v = 6.0818e+192 y = 6.0833e+192 s = 1000000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 0 v = 7.4751e+196 y = 7.4757e+196 s = 1000001 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 2.9900e+197 v = 1.2250e+201 y = 1.2251e+201 s = 1000010 v = 0 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 1.9596e+202 v = 2.0085e+205 y = 2.0087e+205 s = 1000011 v = 8.0263e+205 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 4.0132e+206 v = 3.2916e+209 y = 3.2918e+209 s = 1000100 v = 0 v = 0 v = 2.1041e+211 v = 2.1041e+211 v = 2.1041e+211 v = 2.1041e+211 v = 5.4074e+213 y = 5.4077e+213 s = 1000101 v = 2.1546e+214 v = 2.1546e+214 v = 3.6627e+215 v = 3.6627e+215 v = 3.6627e+215 v = 3.6627e+215 v = 8.8617e+217 y = 8.8622e+217 s = 1000110 v = 0 v = 1.4120e+219 v = 7.0600e+219 v = 7.0600e+219 v = 7.0600e...

Assertion failed.

6   Fail
base=7;nstart=1234;nend=2345;y_correct=843569026324; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 1.0011e+10 v = 0 v = 4 v = 4 v = 4 v = 260 v = 260 v = 4356 v = 20740 v = 20740 v = 20740 v = 1069316 y = 1069316 s = 1.0011e+10 v = 4194304 v = 20971520 v = 20971520 v = 20971520 v = 1.0947e+09 v = 1.0947e+09 v = 1.8275e+10 v = 8.6994e+10 v = 8.6994e+10 v = 8.6994e+10 v = 4.4850e+12 y = 4.4850e+12 s = 1.0011e+10 v = 0 v = 0 v = 2.8147e+14 v = 2.8147e+14 v = 4.7851e+15 v = 4.7851e+15 v = 7.6843e+16 v = 3.6507e+17 v = 3.6507e+17 v = 3.6507e+17 v = 1.8812e+19 y = 1.8812e+19 s = 1.0011e+10 v = 7.3787e+19 v = 7.3787e+19 v = 1.2544e+21 v = 1.2544e+21 v = 2.0144e+22 v = 2.0144e+22 v = 3.2238e+23 v = 1.5313e+24 v = 1.5313e+24 v = 1.5313e+24 v = 7.8903e+25 y = 7.8903e+25 s = 1.0011e+10 v = 0 v = 1.2379e+27 v = 6.1897e+27 v = 6.1897e+27 v = 8.5418e+28 v = 8.5418e+28 v = 1.3531e+30 v = 6.4237e+30 v = 6.4237e+30 v = 6.4237e+30 v = 3.3094e+32 y = 3.3094e+32 s = 1.0011e+10 v = 1.2981e+33 v = 6.4904e+33 v = 2.7260e+34 v = 2.7260e+34 v = 3.5957e+35 v = 3.5957e+35 v = 5.6765e+36 v = 2.6944e+37 v = 2.6944e+37 v = 2.6944e+37 v = 1.3881e+39 y = 1.3881e+39 s = 1.0011e+10 v = 0 v = 0 v = 0 v = 3.4845e+41 v = 1.7422e+42 v = 1.7422e+42 v = 2.4043e+43 v = 1.1325e+44 v = 1.1325e+44 v = 1.1325e+44 v = 5.8222e+45 y = 5.8222e+45 s = 1.0011e+10 v = 2.2836e+46 v = 2.2836e+46 v = 2.2836e+46 v = 1.4843e+48 v = 7.3303e+48 v = 7.3303e+48 v = 1.0087e+50 v = 4.7501e+50 v = 4.7501e+50 v = 4.7501e+50 v = 2.4420e+52 y = 2.4420e+52 s = 1.0011e+10 v = 0 v = 3.8312e+53 v = 3.8312e+53 v = 6.5131e+54 v = 3.1033e+55 v = 3.1033e+55 v = 4.2335e+56 v = 1.9926e+57 v = 1.9926e+57 v = 1.9926e+57 v = 1.0243e+59 y = 1.0243e+59 s = 1.0011e+10 v = 4.0173e+59 v = 2.0087e+60 v = 2.0087e+60 v = 2.7720e+61 v = 1.3056e+62 v = 1.3056e+62 v = 1.7761e+63 v = 8.3581e+63 v = 8.3581e+63 v = 8.3581e+63 v = 4.2961e+65 y = 4.2961e+65 s = 1.0011e+10 v = 0 v = 0 v = 2.6960e+67 v = 1.3480e+68 v = 5.6616e+68 v = 5.6616e+68 v = 7.4679e+69 v = 3.5075e+70 v = 3.5075e+70 v = 3.5075e+70 v = 1.8019e+72 y = 1.8019e+72 s = 1.0011e+10 v = 7.0674e+72 v = 7.0674e+72 v = 1.2015e+74 v = 5.7246e+74 v = 2.3817e+75 v = 2.3817e+75 v = 3.1330e+76 v = 1.4712e+77 v = 1.4712e+77 v = 1.4712e+77 v = 7.5578e+78 y = 7.5578e+78 s = 1.0011e+10 v = 0 v = 1.1857e+80 v = 5.9286e+80 v = 2.4900e+81 v = 1.0079e+82 v = 1.0079e+82 v = 1.3150e+83 v = 6.1716e+83 v = 6.1716e+83 v = 6.1716e+83 v = 3.1700e+85 y = 3.1700e+85 s = 1.0011e+10 v = 1.2433e+86 v = 6.2165e+86 v = 2.6109e+87 v = 1.0568e+88 v = 4.2397e+88 v = 4.2397e+88 v = 5.5166e+89 v = 2.5887e+90 v = 2.5887e+90 v = 2.5887e+90 v = 1.3296e+92 y = 1.3296e+92 s = 1.0011e+10 v = 0 v = 0 v = 0 v = 0 v = 0 v = 5.3400e+95 v = 2.6700e+96 v = 1.1214e+97 v = 1.1214e+97 v = 1.1214e+97 v = 5.5803e+98 y = 5.5803e+98 s = 1.0011e+10 v = 2.1873e+99 v = 2.1873e+99 v = 2.1873e+99 v = 2.1873e+99 v = 2.1873e+99 v = 2.2419e+102 v = 1.1201e+103 v = 4.7037e+103 v = 4.7037e+103 v = 4.7037e+103 v = 2.3405e+105 y = 2.3405e+105 s = 1.0011e+10 v = 0 v = 3.6696e+106 v = 3.6696e+106 v = 3.6696e+106 v = 3.6696e+106 v = 9.4309e+108 v = 4.7008e+109 v = 1.9731e+110 v = 1.9731e+110 v = 1.9731e+110 v = 9.8169e+111 y = 9.8169e+111 s = 1.0011e+10 v = 3.8479e+112 v = 1.9239e+113 v = 1.9239e+113 v = 1.9239e+113 v = 1.9239e+113 v = 3.9594e+115 v = 1.9720e+116 v = 8.2763e+116 v = 8.2763e+116 v = 8.2763e+116 v = 4.1175e+118 y = 4.1175e+118 s = 1.0011e+10 v = 0 v = 0 v = 2.5822e+120 v = 2.5822e+120 v = 2.5822e+120 v = 1.6785e+122 v = 8.2890e+122 v = 3.4731e+123 v = 3.4731e+123 v = 3.4731e+123 v = 1.7270e+125 y = 1.7270e+125 s = 1.0011e+10 v = 6.7692e+125 v = 6.7692e+125 v = 1.1508e+127 v = 1.1508e+127 v = 1.1508e+127 v = 7.0468e+128 v = 3.4773e+129 v = 1.4568e+130 v = 1.4568e+130 v = 1.4568e+130 v = 7.2437e+131 y = 7.2437e+131 s = 1.0011e+10 v = 0 v = 1.1357e+133 v = 5.6784e+133 v = 5.6784e+133 v = 5.6784e+133 v = 2.9641e+135 v = 1.4594e+136 v = 6.1111e+136 v = 6.1111e+136 v = 6.1111e+136 v = 3.0382e+138 y = 3.0382e+138 s = 1.0011e+10 v = 1.1909e+139 v = 5.9543e+139 v = 2.5008e+140 v = 2.5008e+140 v = 2.5008e+140 v = 1.2444e+142 v = 6.1222e+142 v = 2.5633e+143 v = 2.5633e+143 v = 2.5633e+143 v = 1.2743e+145 y = 1.2743e+145 s = 1.0011e+10 v = 0 v = 0 v = 0 v = 3.1967e+147 v = 3.1967e+147 v = 5.4343e+148 v = 2.5893e+149 v = 1.0773e+150 v = 1.0773e+150 v = 1.0773e+150 v = 5.3452e+151 y = 5.3452e+151 s = 1.0011e+10 v = 2.0950e+152 v = 2.0950e+152 v = 2.0950e+152 v = 1.3617e+154 v = 1.3617e+154 v = 2.2814e+155 v = 1.0862e+156 v = 4.5186e+156 v = 4.5186e+156 v = 4.5186e+156 v = 2.2419e+158 y = 2.2419e+158 s = 1.0011e+10 v = 0 v = 3.5148e+159 v = 3.5148e+159 v = 5.9751e+160 v = 5.9751e+160 v = 9.5953e+161 v = 4.5587e+162 v = 1.8955e+163 v = 1.8955e+163 v = 1.8955e+163 v = 9.4033e+164 y = 9.4033e+164 s = 1.0011e+10 v = 3.6855e+165 v = 1.8428e+166 v = 1.8428e+166 v = 2.5430e+167 v = 2.5430e+167 v = 4.0283e+168 v = 1.9124e+169 v = 7.9508e+169 v = 7.9508e+169 v = 7.9508e+169 v = 3.9440e+171 y = 3.9440e+171 s = 1.0011e+10 v = 0 v = 0 v = 2.4733e+173 v = 1.2367e+174 v = 1.2367e+174 v = 1.7066e+175 v = 8.0382e+175 v = 3.3365e+176 v = 3.3365e+176 v = 3.3365e+176 v = 1.6543e+178 y = 1.6543e+178 s = 1.0011e+10 v = 6.4836e+178 v = 6.4836e+178 v = 1.1022e+180 v = 5.2517e+180 v = 5.2517e+180 v = 7.1644e+181 v = 3.3721e+182 v = 1.3995e+183 v = 1.3995e+183 v = 1.3995e+183 v = 6.9385e+184 y = 6.9385e+184 s = 1.0011e+10 v = 0 v = 1.0878e+186 v = 5.4389e+186 v = 2.2843e+187 v = 2.2843e+187 v = 3.0131e+188 v = 1.4152e+189 v = 5.8707e+189 v = 5.8707e+189 v = 5.8707e+189 v = 2.9102e+191 y = 2.9102e+191 s = 1.0011e+10 v = 1.1406e+192 v = 5.7031e+192 v = 2.3953e+193 v = 9.6952e+193 v = 9.6952e+193 v = 1.2649e+195 v = 5.9369e+195 v = 2.4625e+196 v = 2.4625e+196 v = 2.4625e+196 v = 1.2206e+198 y = 1.2206e+198 s = 1.0011e+10 v = 0 v = 0 v = 0 v = 0 v = 1.2247e+201 v = 6.1236e+201 v = 2.5719e+202 v = 1.0410e+203 v = 1.0410e+203 v = 1.0410e+203 v = 5.1206e+204 y = 5.1206e+204 s = 1.0011e+10 v = 2.0066e+205 v = 2.0066e+205 v = 2.0066e+205 v = 2.0066e+205 v = 5.1569e+207 v = 2.5704e+208 v = 1.0789e+209 v = 4.3665e+209 v = 4.3665e+209 v = 4.3665e+209 v = 2.1477e+211 y = 2.1477e+211 s = 1.0011e+10 v = 0 v = 3.3665e+212 v = 3.3665e+212 v = 3.3665e+212 v = 2.1882e+214 v = 1.0806e+215 v = 4.5279e+215 v = 1.8317e+216 v = 1.8317e+216 v = 1.8317e+216 v = 9.0082e+217 y = 9.0082e+217 s = 1.0011e+10 v = 3.5300e+218 v = 1.7650e+219 v = 1.7650e+219 v = 1.7650e+219 v = 9.2133e+220 v = 4.5361e+221 v = 1.8995e+222 v = 7.6831e+222 v = 7.6831e+222 v = 7.6831e+222 v = 3.7783e+224 y = 3.7783e+224 s = 1.0011e+10 v = 0 v = 0 v = 2.3690e+226 v = 2.3690e+226 v = 4.0272e+227 v = 1.9189e+228 v = 7.9834e+228 v = 3.2241e+229 v = 3.2241e+229 v = 3.2241e+229 v = 1.5848e+231 y = 1.5848e+231 s = 1.0011e+10 v = 6.2101e+231 v = 6.2101e+231 v = 1.0557e+233 v = 1.0557e+233 v = 1.6953e+234 v = 8.0545e+234 v = 3.3491e+235 v = 1.3524e+236 v = 1.3524e+236 v = 1.3524e+236 v = 6.6470e+237 y = 6.6470e+237 s = 1.0011e+10 v = 0 v = 1.0419e+239 v = 5.2094e+239 v = 5.2094e+239 v = 7.1890e+240 v = 3.3861e+241 v = 1.4055e+242 v = 5.6730e+242 v = 5.6730e+242 v = 5.6730e+242 v = 2.7879e+244 y = 2.7879e+244 s = 1.0011e+10 v = 1.0925e+245 v = 5.4624e+245 v = 2.2942e+246 v = 2.2942e+246 v = 3.0262e+247 v = 1.4213e+248 v = 5.8962e+248 v = 2.3795e+249 ...

Assertion failed.

7   Fail
base=7;nstart=1;nend=10;y_correct=1265; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

s = 1 v = 1 y = 1 s = 10 v = 0 v = 16 y = 17 s = 11 v = 64 v = 320 y = 337 s = 100 v = 0 v = 0 v = 16384 y = 16721 s = 101 v = 65536 v = 65536 v = 1114112 y = 1130833 s = 110 v = 0 v = 16777216 v = 83886080 y = 85016913 s = 111 v = 268435456 v = 1.3422e+09 v = 5.6371e+09 y = 5.7222e+09 s = 1000 v = 0 v = 0 v = 0 v = 1.0995e+12 y = 1.1052e+12 s = 1001 v = 4.3980e+12 v = 4.3980e+12 v = 4.3980e+12 v = 2.8587e+14 y = 2.8698e+14 s = 1010 v = 0 v = 4.5036e+15 v = 4.5036e+15 v = 7.6561e+16 y = 7.6848e+16

Assertion failed.

8   Fail
nstart=1;nend=50; junk=arrayfun(@(base) sum_distinct_powers(base,nstart,nend),2:10); y_correct=[1275 7120 26365 75000 178591 374560 714465 1266280 2116675]; assert(isequal(junk,y_correct))

s = 1 v = 1 y = 1 s = 10 v = 0 v = 16 y = 17 s = 11 v = 64 v = 320 y = 337 s = 100 v = 0 v = 0 v = 16384 y = 16721 s = 101 v = 65536 v = 65536 v = 1114112 y = 1130833 s = 110 v = 0 v = 16777216 v = 83886080 y = 85016913 s = 111 v = 268435456 v = 1.3422e+09 v = 5.6371e+09 y = 5.7222e+09 s = 1000 v = 0 v = 0 v = 0 v = 1.0995e+12 y = 1.1052e+12 s = 1001 v = 4.3980e+12 v = 4.3980e+12 v = 4.3980e+12 v = 2.8587e+14 y = 2.8698e+14 s = 1010 v = 0 v = 4.5036e+15 v = 4.5036e+15 v = 7.6561e+16 y = 7.6848e+16 s = 1011 v = 2.8823e+17 v = 1.4412e+18 v = 1.4412e+18 v = 1.9888e+19 y = 1.9965e+19 s = 1100 v = 0 v = 0 v = 1.1806e+21 v = 5.9030e+21 y = 5.9229e+21 s = 1101 v = 1.8889e+22 v = 1.8889e+22 v = 3.2112e+23 v = 1.5300e+24 y = 1.5360e+24 s = 1110 v = 0 v = 1.9343e+25 v = 9.6714e+25 v = 4.0620e+26 y = 4.0774e+26 s = 1111 v = 1.2379e+27 v = 6.1897e+27 v = 2.5997e+28 v = 1.0522e+29 y = 1.0563e+29 s = 10000 v = 0 v = 0 v = 0 v = 0 v = 8.1130e+31 y = 8.1235e+31 s = 10001 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 8.3401e+34 y = 8.3483e+34 s = 10010 v = 0 v = 1.3292e+36 v = 1.3292e+36 v = 1.3292e+36 v = 8.6400e+37 y = 8.6483e+37 s = 10011 v = 3.4028e+38 v = 1.7014e+39 v = 1.7014e+39 v = 1.7014e+39 v = 8.8814e+40 y = 8.8900e+40 s = 10100 v = 0 v = 0 v = 5.5752e+42 v = 5.5752e+42 v = 9.4778e+43 y = 9.4867e+43 s = 10101 v = 3.5681e+44 v = 3.5681e+44 v = 6.0658e+45 v = 6.0658e+45 v = 9.7410e+46 y = 9.7505e+46 s = 10110 v = 0 v = 1.4615e+48 v = 7.3075e+48 v = 7.3075e+48 v = 1.0084e+50 y = 1.0094e+50 s = 10111 v = 3.7414e+50 v = 1.8707e+51 v = 7.8570e+51 v = 7.8570e+51 v = 1.0364e+53 y = 1.0374e+53 s = 11000 v = 0 v = 0 v = 0 v = 2.4520e+55 v = 1.2260e+56 y = 1.2270e+56 s = 11001 v = 3.9232e+56 v = 3.9232e+56 v = 3.9232e+56 v = 2.5501e+58 v = 1.2593e+59 y = 1.2606e+59 s = 11010 v = 0 v = 1.6069e+60 v = 1.6069e+60 v = 2.7318e+61 v = 1.3016e+62 y = 1.3029e+62 s = 11011 v = 4.1138e+62 v = 2.0569e+63 v = 2.0569e+63 v = 2.8385e+64 v = 1.3370e+65 y = 1.3383e+65 s = 11100 v = 0 v = 0 v = 6.7400e+66 v = 3.3700e+67 v = 1.4154e+68 y = 1.4167e+68 s = 11101 v = 4.3136e+68 v = 4.3136e+68 v = 7.3331e+69 v = 3.4940e+70 v = 1.4537e+71 y = 1.4551e+71 s = 11110 v = 0 v = 1.7668e+72 v = 8.8342e+72 v = 3.7104e+73 v = 1.5018e+74 y = 1.5033e+74 s = 11111 v = 4.5231e+74 v = 2.2616e+75 v = 9.4986e+75 v = 3.8447e+76 v = 1.5424e+77 y = 1.5439e+77 s = 100000 v = 0 v = 0 v = 0 v = 0 v = 0 v = 4.7428e+80 y = 4.7444e+80 s = 100001 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.8971e+81 v = 1.9446e+84 y = 1.9450e+84 s = 100010 v = 0 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 3.1083e+85 v = 7.9883e+87 y = 7.9902e+87 s = 100011 v = 3.1829e+88 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 1.5914e+89 v = 3.2752e+91 y = 3.2760e+91 s = 100100 v = 0 v = 0 v = 2.0859e+93 v = 2.0859e+93 v = 2.0859e+93 v = 1.3559e+95 y = 1.3562e+95 s = 100101 v = 5.3400e+95 v = 5.3400e+95 v = 9.0779e+96 v = 9.0779e+96 v = 9.0779e+96 v = 5.5589e+98 y = 5.5603e+98 s = 100110 v = 0 v = 8.7490e+99 v = 4.3745e+100 v = 4.3745e+100 v = 4.3745e+100 v = 2.2835e+102 y = 2.2840e+102 s = 100111 v = 8.9590e+102 v = 4.4795e+103 v = 1.8814e+104 v = 1.8814e+104 v = 1.8814e+104 v = 9.3621e+105 y = 9.3644e+105 s = 101000 v = 0 v = 0 v = 0 v = 2.3485e+108 v = 2.3485e+108 v = 3.9925e+109 y = 3.9935e+109 s = 101001 v = 1.5031e+110 v = 1.5031e+110 v = 1.5031e+110 v = 9.7699e+111 v = 9.7699e+111 v = 1.6368e+113 y = 1.6372e+113 s = 101010 v = 0 v = 2.4626e+114 v = 2.4626e+114 v = 4.1865e+115 v = 4.1865e+115 v = 6.7230e+116 y = 6.7246e+116 s = 101011 v = 2.5217e+117 v = 1.2609e+118 v = 1.2609e+118 v = 1.7400e+119 v = 1.7400e+119 v = 2.7562e+120 y = 2.7569e+120 s = 101100 v = 0 v = 0 v = 1.6526e+122 v = 8.2632e+122 v = 8.2632e+122 v = 1.1403e+124 y = 1.1406e+124 s = 101101 v = 4.2308e+124 v = 4.2308e+124 v = 7.1923e+125 v = 3.4269e+126 v = 3.4269e+126 v = 4.6750e+127 y = 4.6761e+127 s = 101110 v = 0 v = 6.9317e+128 v = 3.4658e+129 v = 1.4557e+130 v = 1.4557e+130 v = 1.9201e+131 y = 1.9205e+131 s = 101111 v = 7.0980e+131 v = 3.5490e+132 v = 1.4906e+133 v = 6.0333e+133 v = 6.0333e+133 v = 7.8717e+134 y = 7.8736e+134 s = 110000 v = 0 v = 0 v = 0 v = 0 v = 7.4428e+137 v = 3.7214e+138 y = 3.7222e+138 s = 110001 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 1.1909e+139 v = 3.0605e+141 v = 1.5255e+142 y = 1.5259e+142 s = 110010 v = 0 v = 1.9511e+143 v = 1.9511e+143 v = 1.9511e+143 v = 1.2682e+145 v = 6.2630e+145 y = 6.2645e+145 s = 1 v = 1 y = 1 s = 10 v = 0 v = 16 y = 17 s = 11 v = 64 v = 320 y = 337 s = 100 v = 0 v = 0 v = 16384 y = 16721 s = 101 v = 65536 v = 65536 v = 1114112 y = 1130833 s = 110 v = 0 v = 16777216 v = 83886080 y = 85016913 s = 111 v = 268435456 v = 1.3422e+09 v = 5.6371e+09 y = 5.7222e+09 s = 1000 v = 0 v = 0 v = 0 v = 1.0995e+12 y = 1.1052e+12 s = 1001 v = 4.3980e+12 v = 4.3980e+12 v = 4.3980e+12 v = 2.8587e+14 y = 2.8698e+14 s = 1010 v = 0 v = 4.5036e+15 v = 4.5036e+15 v = 7.6561e+16 y = 7.6848e+16 s = 1011 v = 2.8823e+17 v = 1.4412e+18 v = 1.4412e+18 v = 1.9888e+19 y = 1.9965e+19 s = 1100 v = 0 v = 0 v = 1.1806e+21 v = 5.9030e+21 y = 5.9229e+21 s = 1101 v = 1.8889e+22 v = 1.8889e+22 v = 3.2112e+23 v = 1.5300e+24 y = 1.5360e+24 s = 1110 v = 0 v = 1.9343e+25 v = 9.6714e+25 v = 4.0620e+26 y = 4.0774e+26 s = 1111 v = 1.2379e+27 v = 6.1897e+27 v = 2.5997e+28 v = 1.0522e+29 y = 1.0563e+29 s = 10000 v = 0 v = 0 v = 0 v = 0 v = 8.1130e+31 y = 8.1235e+31 s = 10001 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 3.2452e+32 v = 8.3401e+34 y = 8.3483e+34 s = 10010 v = 0 v = 1.3292e+36 v = 1.3292e+36 v = 1.3292e+36 v = 8.6400e+37 y = 8.6483e+37 s = 10011 v = 3.4028e+38 v = 1.7014e+39 v = 1.7014e+39 v = 1.7014e+39 v = 8.8814e+40 y = 8.8900e+40 s = 10100 v = 0 v = 0 v = 5.5752e+42 v = 5.5752e+42 v = 9.4778e+43 y = 9.4867e+43 s = 10101 v = 3.5681e+44 v = 3.5681e+44 v = 6.0658e+45 v = 6.0658e+45 v = 9.7410e+46 y = 9.7505e+46 s = 10110 v = 0 v = 1.4615e+48 v = 7.3075e+48 v = 7.3075e+48 v = 1.0084e+50 y = 1.0094e+50 s = 10111 v = 3.7414e+50 v = 1.8707e+51 v = 7.8570e+51 v = 7.8570e+51 v = 1.0364e+53 y = 1.0374e+53 s = 11000 v = 0 v = 0 v = 0 v = 2.4520e+55 v = 1.2260e+56 y = 1.2270e+56 s = 11001 v = 3.9232e+56 v = 3.9232e+56 v = 3.9232e+56 v = 2.5501e+58 v = 1.2593e+59 y = 1.2606e+59 s = 11010 v = 0 v = 1.6069e+60 v = 1.6069e+60 v = 2.7318e+61 v = 1.3016e+62 y = 1.3029e+62 s = 11011 v = 4.1138e+62 v = 2.0569e+63 v = 2.0569e+63 v = 2.8385e+64 v = 1.3370e+65 y = 1.3383e+65 s = 11100 v = 0 v = 0 v = 6.7400e+66 v = 3.3700e+67 v = 1.4154e+68 y = 1.4167e+68 s = ...

Assertion failed.