Cody

# Problem 1172. Wheat on a chessboard pt 1

Solution 2073716

Submitted on 29 Dec 2019 by Pontus Wehlin
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
n = 1; y_correct = 1; assert(isequal(wheat_chess(n),y_correct))

2   Pass
n = 0; y_correct = 0; assert(isequal(wheat_chess(n),y_correct))

3   Pass
n = -1; y_correct = 'NaN'; assert(isequal(wheat_chess(n),y_correct))

4   Pass
n = 4; y_correct = 65535; assert(isequal(wheat_chess(n),y_correct))

k = 2 i = 2 l = 3 k = 4 i = 3 l = 7 k = 8 i = 4 l = 15 k = 16 i = 5 l = 31 k = 32 i = 6 l = 63 k = 64 i = 7 l = 127 k = 128 i = 8 l = 255 k = 256 i = 9 l = 511 k = 512 i = 10 l = 1023 k = 1024 i = 11 l = 2047 k = 2048 i = 12 l = 4095 k = 4096 i = 13 l = 8191 k = 8192 i = 14 l = 16383 k = 16384 i = 15 l = 32767 k = 32768 i = 16 l = 65535

5   Pass
n = 8; y_correct = 18446744073709551615; assert(isequal(wheat_chess(n),y_correct))

k = 2 i = 2 l = 3 k = 4 i = 3 l = 7 k = 8 i = 4 l = 15 k = 16 i = 5 l = 31 k = 32 i = 6 l = 63 k = 64 i = 7 l = 127 k = 128 i = 8 l = 255 k = 256 i = 9 l = 511 k = 512 i = 10 l = 1023 k = 1024 i = 11 l = 2047 k = 2048 i = 12 l = 4095 k = 4096 i = 13 l = 8191 k = 8192 i = 14 l = 16383 k = 16384 i = 15 l = 32767 k = 32768 i = 16 l = 65535 k = 65536 i = 17 l = 131071 k = 131072 i = 18 l = 262143 k = 262144 i = 19 l = 524287 k = 524288 i = 20 l = 1048575 k = 1048576 i = 21 l = 2097151 k = 2097152 i = 22 l = 4194303 k = 4194304 i = 23 l = 8388607 k = 8388608 i = 24 l = 16777215 k = 16777216 i = 25 l = 33554431 k = 33554432 i = 26 l = 67108863 k = 67108864 i = 27 l = 134217727 k = 134217728 i = 28 l = 268435455 k = 268435456 i = 29 l = 536870911 k = 536870912 i = 30 l = 1.0737e+09 k = 1.0737e+09 i = 31 l = 2.1475e+09 k = 2.1475e+09 i = 32 l = 4.2950e+09 k = 4.2950e+09 i = 33 l = 8.5899e+09 k = 8.5899e+09 i = 34 l = 1.7180e+10 k = 1.7180e+10 i = 35 l = 3.4360e+10 k = 3.4360e+10 i = 36 l = 6.8719e+10 k = 6.8719e+10 i = 37 l = 1.3744e+11 k = 1.3744e+11 i = 38 l = 2.7488e+11 k = 2.7488e+11 i = 39 l = 5.4976e+11 k = 5.4976e+11 i = 40 l = 1.0995e+12 k = 1.0995e+12 i = 41 l = 2.1990e+12 k = 2.1990e+12 i = 42 l = 4.3980e+12 k = 4.3980e+12 i = 43 l = 8.7961e+12 k = 8.7961e+12 i = 44 l = 1.7592e+13 k = 1.7592e+13 i = 45 l = 3.5184e+13 k = 3.5184e+13 i = 46 l = 7.0369e+13 k = 7.0369e+13 i = 47 l = 1.4074e+14 k = 1.4074e+14 i = 48 l = 2.8147e+14 k = 2.8147e+14 i = 49 l = 5.6295e+14 k = 5.6295e+14 i = 50 l = 1.1259e+15 k = 1.1259e+15 i = 51 l = 2.2518e+15 k = 2.2518e+15 i = 52 l = 4.5036e+15 k = 4.5036e+15 i = 53 l = 9.0072e+15 k = 9.0072e+15 i = 54 l = 1.8014e+16 k = 1.8014e+16 i = 55 l = 3.6029e+16 k = 3.6029e+16 i = 56 l = 7.2058e+16 k = 7.2058e+16 i = 57 l = 1.4412e+17 k = 1.4412e+17 i = 58 l = 2.8823e+17 k = 2.8823e+17 i = 59 l = 5.7646e+17 k = 5.7646e+17 i = 60 l = 1.1529e+18 k = 1.1529e+18 i = 61 l = 2.3058e+18 k = 2.3058e+18 i = 62 l = 4.6117e+18 k = 4.6117e+18 i = 63 l = 9.2234e+18 k = 9.2234e+18 i = 64 l = 1.8447e+19

6   Pass
n = 10; y_correct = 1267650600228229401496703205375; assert(isequal(wheat_chess(n),y_correct))

k = 2 i = 2 l = 3 k = 4 i = 3 l = 7 k = 8 i = 4 l = 15 k = 16 i = 5 l = 31 k = 32 i = 6 l = 63 k = 64 i = 7 l = 127 k = 128 i = 8 l = 255 k = 256 i = 9 l = 511 k = 512 i = 10 l = 1023 k = 1024 i = 11 l = 2047 k = 2048 i = 12 l = 4095 k = 4096 i = 13 l = 8191 k = 8192 i = 14 l = 16383 k = 16384 i = 15 l = 32767 k = 32768 i = 16 l = 65535 k = 65536 i = 17 l = 131071 k = 131072 i = 18 l = 262143 k = 262144 i = 19 l = 524287 k = 524288 i = 20 l = 1048575 k = 1048576 i = 21 l = 2097151 k = 2097152 i = 22 l = 4194303 k = 4194304 i = 23 l = 8388607 k = 8388608 i = 24 l = 16777215 k = 16777216 i = 25 l = 33554431 k = 33554432 i = 26 l = 67108863 k = 67108864 i = 27 l = 134217727 k = 134217728 i = 28 l = 268435455 k = 268435456 i = 29 l = 536870911 k = 536870912 i = 30 l = 1.0737e+09 k = 1.0737e+09 i = 31 l = 2.1475e+09 k = 2.1475e+09 i = 32 l = 4.2950e+09 k = 4.2950e+09 i = 33 l = 8.5899e+09 k = 8.5899e+09 i = 34 l = 1.7180e+10 k = 1.7180e+10 i = 35 l = 3.4360e+10 k = 3.4360e+10 i = 36 l = 6.8719e+10 k = 6.8719e+10 i = 37 l = 1.3744e+11 k = 1.3744e+11 i = 38 l = 2.7488e+11 k = 2.7488e+11 i = 39 l = 5.4976e+11 k = 5.4976e+11 i = 40 l = 1.0995e+12 k = 1.0995e+12 i = 41 l = 2.1990e+12 k = 2.1990e+12 i = 42 l = 4.3980e+12 k = 4.3980e+12 i = 43 l = 8.7961e+12 k = 8.7961e+12 i = 44 l = 1.7592e+13 k = 1.7592e+13 i = 45 l = 3.5184e+13 k = 3.5184e+13 i = 46 l = 7.0369e+13 k = 7.0369e+13 i = 47 l = 1.4074e+14 k = 1.4074e+14 i = 48 l = 2.8147e+14 k = 2.8147e+14 i = 49 l = 5.6295e+14 k = 5.6295e+14 i = 50 l = 1.1259e+15 k = 1.1259e+15 i = 51 l = 2.2518e+15 k = 2.2518e+15 i = 52 l = 4.5036e+15 k = 4.5036e+15 i = 53 l = 9.0072e+15 k = 9.0072e+15 i = 54 l = 1.8014e+16 k = 1.8014e+16 i = 55 l = 3.6029e+16 k = 3.6029e+16 i = 56 l = 7.2058e+16 k = 7.2058e+16 i = 57 l = 1.4412e+17 k = 1.4412e+17 i = 58 l = 2.8823e+17 k = 2.8823e+17 i = 59 l = 5.7646e+17 k = 5.7646e+17 i = 60 l = 1.1529e+18 k = 1.1529e+18 i = 61 l = 2.3058e+18 k = 2.3058e+18 i = 62 l = 4.6117e+18 k = 4.6117e+18 i = 63 l = 9.2234e+18 k = 9.2234e+18 i = 64 l = 1.8447e+19 k = 1.8447e+19 i = 65 l = 3.6893e+19 k = 3.6893e+19 i = 66 l = 7.3787e+19 k = 7.3787e+19 i = 67 l = 1.4757e+20 k = 1.4757e+20 i = 68 l = 2.9515e+20 k = 2.9515e+20 i = 69 l = 5.9030e+20 k = 5.9030e+20 i = 70 l = 1.1806e+21 k = 1.1806e+21 i = 71 l = 2.3612e+21 k = 2.3612e+21 i = 72 l = 4.7224e+21 k = 4.7224e+21 i = 73 l = 9.4447e+21 k = 9.4447e+21 i = 74 l = 1.8889e+22 k = 1.8889e+22 i = 75 l = 3.7779e+22 k = 3.7779e+22 i = 76 l = 7.5558e+22 k = 7.5558e+22 i = 77 l = 1.5112e+23 k = 1.5112e+23 i = 78 l = 3.0223e+23 k = 3.0223e+23 i = 79 l = 6.0446e+23 k = 6.0446e+23 i = 80 l = 1.2089e+24 k = 1.2089e+24 i = 81 l = 2.4179e+24 k = 2.4179e+24 i = 82 l = 4.8357e+24 k = 4.8357e+24 i = 83 l = 9.6714e+24 k = 9.6714e+24 i = 84 l = 1.9343e+25 k = 1.9343e+25 i = 85 l = 3.8686e+25 k = 3.8686e+25 i = 86 l = 7.7371e+25 k = 7.7371e+25 i = 87 l = 1.5474e+26 k = 1.5474e+26 i = 88 l = 3.0949e+26 k = 3.0949e+26 i = 89 l = 6.1897e+26 k = 6.1897e+26 i = 90 l = 1.2379e+27 k = 1.2379e+27 i = 91 l = 2.4759e+27 k = 2.4759e+27 i = 92 l = 4.9518e+27 k = 4.9518e+27 i = 93 l = 9.9035e+27 k = 9.9035e+27 i = 94 l = 1.9807e+28 k = 1.9807e+28 i = 95 l = 3.9614e+28 k = 3.9614e+28 i = 96 l = 7.9228e+28 k = 7.9228e+28 i = 97 l = 1.5846e+29 k = 1.5846e+29 i = 98 l = 3.1691e+29 k = 3.1691e+29 i = 99 l = 6.3383e+29 k = 6.3383e+29 i = 100 l = 1.2677e+30