Cody

# Problem 189. Sum all integers from 1 to 2^n

Solution 585543

Submitted on 20 Feb 2015 by PARTH PATEL
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = 7; y_correct = 8256; assert(isequal(sum_int(x),y_correct))

p = 1 p = 3 p = 6 p = 10 p = 15 p = 21 p = 28 p = 36 p = 45 p = 55 p = 66 p = 78 p = 91 p = 105 p = 120 p = 136 p = 153 p = 171 p = 190 p = 210 p = 231 p = 253 p = 276 p = 300 p = 325 p = 351 p = 378 p = 406 p = 435 p = 465 p = 496 p = 528 p = 561 p = 595 p = 630 p = 666 p = 703 p = 741 p = 780 p = 820 p = 861 p = 903 p = 946 p = 990 p = 1035 p = 1081 p = 1128 p = 1176 p = 1225 p = 1275 p = 1326 p = 1378 p = 1431 p = 1485 p = 1540 p = 1596 p = 1653 p = 1711 p = 1770 p = 1830 p = 1891 p = 1953 p = 2016 p = 2080 p = 2145 p = 2211 p = 2278 p = 2346 p = 2415 p = 2485 p = 2556 p = 2628 p = 2701 p = 2775 p = 2850 p = 2926 p = 3003 p = 3081 p = 3160 p = 3240 p = 3321 p = 3403 p = 3486 p = 3570 p = 3655 p = 3741 p = 3828 p = 3916 p = 4005 p = 4095 p = 4186 p = 4278 p = 4371 p = 4465 p = 4560 p = 4656 p = 4753 p = 4851 p = 4950 p = 5050 p = 5151 p = 5253 p = 5356 p = 5460 p = 5565 p = 5671 p = 5778 p = 5886 p = 5995 p = 6105 p = 6216 p = 6328 p = 6441 p = 6555 p = 6670 p = 6786 p = 6903 p = 7021 p = 7140 p = 7260 p = 7381 p = 7503 p = 7626 p = 7750 p = 7875 p = 8001 p = 8128 p = 8256

2   Pass
%% x = 10; y_correct = 524800; assert(isequal(sum_int(x),y_correct))

p = 1 p = 3 p = 6 p = 10 p = 15 p = 21 p = 28 p = 36 p = 45 p = 55 p = 66 p = 78 p = 91 p = 105 p = 120 p = 136 p = 153 p = 171 p = 190 p = 210 p = 231 p = 253 p = 276 p = 300 p = 325 p = 351 p = 378 p = 406 p = 435 p = 465 p = 496 p = 528 p = 561 p = 595 p = 630 p = 666 p = 703 p = 741 p = 780 p = 820 p = 861 p = 903 p = 946 p = 990 p = 1035 p = 1081 p = 1128 p = 1176 p = 1225 p = 1275 p = 1326 p = 1378 p = 1431 p = 1485 p = 1540 p = 1596 p = 1653 p = 1711 p = 1770 p = 1830 p = 1891 p = 1953 p = 2016 p = 2080 p = 2145 p = 2211 p = 2278 p = 2346 p = 2415 p = 2485 p = 2556 p = 2628 p = 2701 p = 2775 p = 2850 p = 2926 p = 3003 p = 3081 p = 3160 p = 3240 p = 3321 p = 3403 p = 3486 p = 3570 p = 3655 p = 3741 p = 3828 p = 3916 p = 4005 p = 4095 p = 4186 p = 4278 p = 4371 p = 4465 p = 4560 p = 4656 p = 4753 p = 4851 p = 4950 p = 5050 p = 5151 p = 5253 p = 5356 p = 5460 p = 5565 p = 5671 p = 5778 p = 5886 p = 5995 p = 6105 p = 6216 p = 6328 p = 6441 p = 6555 p = 6670 p = 6786 p = 6903 p = 7021 p = 7140 p = 7260 p = 7381 p = 7503 p = 7626 p = 7750 p = 7875 p = 8001 p = 8128 p = 8256 p = 8385 p = 8515 p = 8646 p = 8778 p = 8911 p = 9045 p = 9180 p = 9316 p = 9453 p = 9591 p = 9730 p = 9870 p = 10011 p = 10153 p = 10296 p = 10440 p = 10585 p = 10731 p = 10878 p = 11026 p = 11175 p = 11325 p = 11476 p = 11628 p = 11781 p = 11935 p = 12090 p = 12246 p = 12403 p = 12561 p = 12720 p = 12880 p = 13041 p = 13203 p = 13366 p = 13530 p = 13695 p = 13861 p = 14028 p = 14196 p = 14365 p = 14535 p = 14706 p = 14878 p = 15051 p = 15225 p = 15400 p = 15576 p = 15753 p = 15931 p = 16110 p = 16290 p = 16471 p = 16653 p = 16836 p = 17020 p = 17205 p = 17391 p = 17578 p = 17766 p = 17955 p = 18145 p = 18336 p = 18528 p = 18721 p = 18915 p = 19110 p = 19306 p = 19503 p = 19701 p = 19900 p = 20100 p = 20301 p = 20503 p = 20706 p = 20910 p = 21115 p = 21321 p = 21528 p = 21736 p = 21945 p = 22155 p = 22366 p = 22578 p = 22791 p = 23005 p = 23220 p = 23436 p = 23653 p = 23871 p = 24090 p = 24310 p = 24531 p = 24753 p = 24976 p = 25200 p = 25425 p = 25651 p = 25878 p = 26106 p = 26335 p = 26565 p = 26796 p = 27028 p = 27261 p = 27495 p = 27730 p = 27966 p = 28203 p = 28441 p = 28680 p = 28920 p = 29161 p = 29403 p = 29646 p = 29890 p = 30135 p = 30381 p = 30628 p = 30876 p = 31125 p = 31375 p = 31626 p = 31878 p = 32131 p = 32385 p = 32640 p = 32896 p = 33153 p = 33411 p = 33670 p = 33930 p = 34191 p = 34453 p = 34716 p = 34980 p = 35245 p = 35511 p = 35778 p = 36046 p = 36315 p = 36585 p = 36856 p = 37128 p = 37401 p = 37675 p = 37950 p = 38226 p = 38503 p = 38781 p = 39060 p = 39340 p = 39621 p = 39903 p = 40186 p = 40470 p = 40755 p = 41041 p = 41328 p = 41616 p = 41905 p = 42195 p = 42486 p = 42778 p = 43071 p = 43365 p = 43660 p = 43956 p = 44253 p = 44551 p = 44850 p = 45150 p = 45451 p = 45753 p = 46056 p = 46360 p = 46665 p = 46971 p = 47278 p = 47586 p = 47895 p = 48205 p = 48516 p = 48828 p = 49141 p = 49455 p = 49770 p = 50086 p = 50403 p = 50721 p = 51040 p = 51360 p = 51681 p = 52003 p = 52326 p = 52650 p = 52975 p = 53301 p = 53628 p = 53956 p = 54285 p = 54615 p = 54946 p = 55278 p = 55611 p = 55945 p = 56280 p = 56616 p = 56953 p = 57291 p = 57630 p = 57970 p = 58311 p = 58653 p = 58996 p = 59340 p = 59685 p = 60031 p = 60378 p = 60726 p = 61075 p = 61425 p = 61776 p = 62128 p = 62481 p = 62835 p = 63190 p = 63546 p = 63903 p = 64261 p = 64620 p = 64980 p = 65341 p = 65703 p = 66066 p = 66430 p = 66795 p = 67161 p = 67528 p = 67896 p = 68265 p = 68635 p = 69006 p = 69378 p = 69751 p = 70125 p = 70500 p = 70876 p = 71253 p = 71631 p = 72010 p = 72390 p = 72771 p = 73153 p = 73536 p = 73920 p = 74305 p = 74691 p = 75078 p = 75466 p = 75855 p = 76245 p = 76636 p = 77028 p = 77421 p = 77815 p = 78210 p = 78606 p = 79003 p = 79401 p = 79800 p = 80200 p = 80601 p = 81003 p = 81406 p = 81810 p = 82215 p = 82621 p = 83028 p = 83436 p = 83845 p = 84255 p = 84666 p = 85078 p = 85491 p = 85905 p = 86320 p = 86736 p = 87153 p = 87571 p = 87990 p = 88410 p = 88831 p = 89253 p = 89676 p = 90100 p = 90525 p = 90951 p = 91378 p = 91806 p = 92235 p = 92665 p = 93096 p = 93528 p = 93961 p = 94395 p = 94830 p = 95266 p = 95703 p = 96141 p = 96580 p = 97020 p = 97461 p = 97903 p = 98346 p = 98790 p = 99235 p = 99681 p = 100128 p = 100576 p = 101025 p = 101475 p = 101926 p = 102378 p = 102831 p = 103285 p = 103740 p = 104196 p = 104653 p = 105111 p = 105570 p = 106030 p = 106491 p = 106953 p = 107416 p = 107880 p = 108345 p = 108811 p = 109278 p = 109746 p = 110215 p = 110685 p = 111156 p = 111628 p = 112101 p = 112575 p = 113050 p = 113526 p = 114003 p = 114481 p = 114960 p = 115440 p = 115921 p = 116403 p = 116886 p = 117370 p = 117855 p = 118341 p = 118828 p = 119316 p = 119805 p = 120295 p = 120786 p = 121278 p = 121771 p = 122265 p = 122760 p = 123256 p = 123753 p = 124251 p = 124750 p = 125250 p = 125751 p = 126253 p = 126756 p = 127260 p = 127765 p = 128271 p = 128778 p = 129286 p = 129795 p = 130305 p = 130816 p = 131328 p = 131841 p = 132355 p = 132870 p = 133386 p = 133903 p = 134421 p = 134940 p = 135460 p = 135981 p = 136503 p = 137026 p = 137550 p = 138075 p = 138601 p = 139128 p = 139656 p = 140185 p = 140715 p = 141246 p = 141778 p = 142311 p = 142845 p = 143380 p = 143916 p = 144453 p = 144991 p = 145530 p = 146070 p = 146611 p = 147153 p = 147696 p = 148240 p = 148785 p = 149331 p = 149878 p = 150426 p = 150975 p = 151525 p = 152076 p = 152628 p = 153181 p = 153735 p = 154290 p = 154846 p = 155403 p = 155961 p = 156520 p = 157080 p = 157641 p = 158203 p = 158766 p = 159330 p = 159895 p = 160461 p = 161028 p = 161596 p = 162165 p = 162735 p = 163306 p = 163878 p = 164451 p = 165025 p = 165600 p = 166176 p = 166753 p = 167331 p = 167910 p = 168490 p = 169071 p = 169653 p = 170236 p = 170820 p = 171405 p = 171991 p = 172578 p = 173166 p = 173755 p = 174345 p = 174936 p = 175528 p = 176121 p = 176715 p = 177310 p = 177906 p = 178503 p = 179101 p = 179700 p = 180300 p = 180901 p = 181503 p = 182106 p = 18...