Cody

# Problem 2577. Sum of series III

Solution 1597167

Submitted on 1 Aug 2018 by Srishti Saha
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; s_correct = 1; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 1 arr = 1 ans = 1

2   Pass
n = 2; s_correct = 28; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 1 2 arr = 1 27 ans = 28

3   Pass
n = 5; s_correct = 1225; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 1 2 3 4 5 arr = 1 27 125 343 729 ans = 1225

4   Pass
n = 10; s_correct = 19900; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 1 2 3 4 5 6 7 8 9 10 arr = 1 27 125 343 729 1331 2197 3375 4913 6859 ans = 19900

5   Pass
n = 42; s_correct = 6221628; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 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 42 30 31 32 33 34 35 36 37 38 39 40 41 42 arr = Columns 1 through 14 1 27 125 343 729 1331 2197 3375 4913 6859 9261 12167 15625 19683 Columns 15 through 28 24389 29791 35937 42875 50653 59319 68921 79507 91125 103823 117649 132651 148877 166375 Columns 29 through 42 185193 205379 226981 250047 274625 300763 328509 357911 389017 421875 456533 493039 531441 571787 ans = 6221628

6   Pass
n = 99; s_correct = 192109401; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 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 99 88 89 90 91 92 93 94 95 96 97 98 99 arr = Columns 1 through 14 1 27 125 343 729 1331 2197 3375 4913 6859 9261 12167 15625 19683 Columns 15 through 28 24389 29791 35937 42875 50653 59319 68921 79507 91125 103823 117649 132651 148877 166375 Columns 29 through 42 185193 205379 226981 250047 274625 300763 328509 357911 389017 421875 456533 493039 531441 571787 Columns 43 through 56 614125 658503 704969 753571 804357 857375 912673 970299 1030301 1092727 1157625 1225043 1295029 1367631 Columns 57 through 70 1442897 1520875 1601613 1685159 1771561 1860867 1953125 2048383 2146689 2248091 2352637 2460375 2571353 2685619 Columns 71 through 84 2803221 2924207 3048625 3176523 3307949 3442951 3581577 3723875 3869893 4019679 4173281 4330747 4492125 4657463 Columns 85 through 98 4826809 5000211 5177717 5359375 5545233 5735339 5929741 6128487 6331625 6539203 6751269 6967871 7189057 7414875 Column 99 7645373 ans = 192109401

7   Pass
n = 124; s_correct = 472827376; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 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 124 117 118 119 120 121 122 123 124 arr = Columns 1 through 14 1 27 125 343 729 1331 2197 3375 4913 6859 9261 12167 15625 19683 Columns 15 through 28 24389 29791 35937 42875 50653 59319 68921 79507 91125 103823 117649 132651 148877 166375 Columns 29 through 42 185193 205379 226981 250047 274625 300763 328509 357911 389017 421875 456533 493039 531441 571787 Columns 43 through 56 614125 658503 704969 753571 804357 857375 912673 970299 1030301 1092727 1157625 1225043 1295029 1367631 Columns 57 through 70 1442897 1520875 1601613 1685159 1771561 1860867 1953125 2048383 2146689 2248091 2352637 2460375 2571353 2685619 Columns 71 through 84 2803221 2924207 3048625 3176523 3307949 3442951 3581577 3723875 3869893 4019679 4173281 4330747 4492125 4657463 Columns 85 through 98 4826809 5000211 5177717 5359375 5545233 5735339 5929741 6128487 6331625 6539203 6751269 6967871 7189057 7414875 Columns 99 through 112 7645373 7880599 8120601 8365427 8615125 8869743 9129329 9393931 9663597 9938375 10218313 10503459 10793861 11089567 Columns 113 through 124 11390625 11697083 12008989 12326391 12649337 12977875 13312053 13651919 13997521 14348907 14706125 15069223 ans = 472827376

8   Pass
n = 222; s_correct = 4857776028; assert(isequal(sumOfSeriesIII(n),s_correct))

k = 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 203 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 201 202 203 Columns 204 through 222 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 arr = Columns 1 through 14 1 27 125 343 729 1331 2197 3375 4913 6859 9261 12167 15625 19683 Columns 15 through 28 24389 29791 35937 42875 50653 59319 68921 79507 91125 103823 117649 132651 148877 166375 Columns 29 through 42 185193 205379 226981 250047 274625 300763 328509 357911 389017 421875 456533 493039 531441 571787 Columns 43 through 56 614125 658503 704969 753571 804357 857375 912673 970299 1030301 1092727 1157625 1225043 1295029 1367631 Columns 57 through 70 1442897 1520875 1601613 1685159 1771561 1860867 1953125 2048383 2146689 2248091 2352637 2460375 2571353 2685619 Columns 71 through 84 2803221 2924207 3048625 3176523 3307949 3442951 3581577 3723875 3869893 4019679 4173281 4330747 4492125 4657463 Columns 85 through 98 4826809 5000211 5177717 5359375 5545233 5735339 5929741 6128487 6331625 6539203 6751269 6967871 7189057 7414875 Columns 99 through 112 7645373 7880599 8120601 8365427 8615125 8869743 9129329 9393931 9663597 9938375 10218313 10503459 10793861 11089567 Columns 113 through 126 11390625 11697083 12008989 12326391 12649337 12977875 13312053 13651919 13997521 14348907 14706125 15069223 15438249 15813251 Columns 127 through 140 16194277 16581375 16974593 17373979 17779581 18191447 18609625 19034163 19465109 19902511 20346417 20796875 21253933 21717639 Columns 141 through 154 22188041 22665187 23149125 23639903 24137569 24642171 25153757 25672375 26198073 26730899 27270901 27818127 28372625 28934443 Columns 155 through 168 29503629 30080231 30664297 31255875 31855013 32461759 33076161 33698267 34328125 34965783 35611289 36264691 36926037 37595375 Columns 169 through 182 38272753 38958219 39651821 40353607 41063625 41781923 42508549 43243551 43986977 44738875 45499293 46268279 47045881 47832147 Columns 183 through 196 48627125 49430863 50243409 51064811 51895117 52734375 53582633 54439939 55306341 56181887 57066625 57960603 58863869 59776471 Columns 197 through 210 60698457 61629875 62570773 63521199 64481201 65450827 66430125 67419143 68417929 69426531 70444997 71473375 72511713 73560059 Columns 211 through 222 74618461 75686967 76765625 77854483 78953589 80062991 81182737 82312875 83453453 84604519 85766121 86938307 ans = 4.8578e+09