Cody

# Problem 240. Project Euler: Problem 6, Natural numbers, squares and sums.

Solution 1485941

Submitted on 10 Apr 2018 by Tiago Dias
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 = 10; y_correct = 2640; assert(isequal(euler006(x),y_correct))

a = 1 2 3 4 5 6 7 8 9 10 a = 1 4 9 16 25 36 49 64 81 100 b = 3025

2   Pass
x = 20; y_correct = 41230; assert(isequal(euler006(x),y_correct))

a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 a = 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 b = 44100

3   Pass
x = 200; y_correct = 401323300; assert(isequal(euler006(x),y_correct))

a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 145 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 Columns 146 through 174 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 Columns 175 through 200 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 a = Columns 1 through 14 1 4 9 16 25 36 49 64 81 100 121 144 169 196 Columns 15 through 28 225 256 289 324 361 400 441 484 529 576 625 676 729 784 Columns 29 through 42 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 Columns 43 through 56 1849 1936 2025 2116 2209 2304 2401 2500 2601 2704 2809 2916 3025 3136 Columns 57 through 70 3249 3364 3481 3600 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 Columns 71 through 84 5041 5184 5329 5476 5625 5776 5929 6084 6241 6400 6561 6724 6889 7056 Columns 85 through 98 7225 7396 7569 7744 7921 8100 8281 8464 8649 8836 9025 9216 9409 9604 Columns 99 through 112 9801 10000 10201 10404 10609 10816 11025 11236 11449 11664 11881 12100 12321 12544 Columns 113 through 126 12769 12996 13225 13456 13689 13924 14161 14400 14641 14884 15129 15376 15625 15876 Columns 127 through 140 16129 16384 16641 16900 17161 17424 17689 17956 18225 18496 18769 19044 19321 19600 Columns 141 through 154 19881 20164 20449 20736 21025 21316 21609 21904 22201 22500 22801 23104 23409 23716 Columns 155 through 168 24025 24336 24649 24964 25281 25600 25921 26244 26569 26896 27225 27556 27889 28224 Columns 169 through 182 28561 28900 29241 29584 29929 30276 30625 30976 31329 31684 32041 32400 32761 33124 Columns 183 through 196 33489 33856 34225 34596 34969 35344 35721 36100 36481 36864 37249 37636 38025 38416 Columns 197 through 200 38809 39204 39601 40000 b = 404010000