Cody

Problem 44360. Pentagonal Numbers

Solution 1701765

Submitted on 3 Jan 2019 by Martin C.
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
x1 = 1; x2 = 25; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1,5,12,22])) assert(isequal(d,[0,1,0,0]))

p = [] pent = 1 p = 1 pent = 5 p = 1 5 pent = 12 p = 1 5 12 pent = 22 p = 1 5 12 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 d = 1×4 logical array 0 1 0 0 p = 1 5 12 22 d = 1×4 logical array 0 1 0 0

2   Pass
x1 = 1; x2 = 4; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,1)) assert(isequal(d,0))

p = [] pent = 1 p = 1 pent = 5 pent = 12 pent = 22 d = logical 0 p = 1 d = logical 0

3   Pass
x1 = 10; x2 = 40; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[12,22,35])) assert(isequal(d,[0,0,1]))

p = [] pent = 1 pent = 5 pent = 12 p = 12 pent = 22 p = 12 22 pent = 35 p = 12 22 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 d = 1×3 logical array 0 0 1 p = 12 22 35 d = 1×3 logical array 0 0 1

4   Pass
x1 = 10; x2 = 99; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[12,22,35,51,70,92])) assert(isequal(d,[0,0,1,0,1,0]))

p = [] pent = 1 pent = 5 pent = 12 p = 12 pent = 22 p = 12 22 pent = 35 p = 12 22 35 pent = 51 p = 12 22 35 51 pent = 70 p = 12 22 35 51 70 pent = 92 p = 12 22 35 51 70 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 pent = 10292 pent = 10542 pent = 10795 pent = 11051 pent = 11310 pent = 11572 pent = 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 d = 1×6 logical array 0 0 1 0 1 0 p = 12 22 35 51 70 92 d = 1×6 logical array 0 0 1 0 1 0

5   Pass
x1 = 100; x2 = 999; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925])) assert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1]))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 p = 117 pent = 145 p = 117 145 pent = 176 p = 117 145 176 pent = 210 p = 117 145 176 210 pent = 247 p = 117 145 176 210 247 pent = 287 p = 117 145 176 210 247 287 pent = 330 p = 117 145 176 210 247 287 330 pent = 376 p = 117 145 176 210 247 287 330 376 pent = 425 p = 117 145 176 210 247 287 330 376 425 pent = 477 p = 117 145 176 210 247 287 330 376 425 477 pent = 532 p = 117 145 176 210 247 287 330 376 425 477 532 pent = 590 p = 117 145 176 210 247 287 330 376 425 477 532 590 pent = 651 p = 117 145 176 210 247 287 330 376 425 477 532 590 651 pent = 715 p = 117 145 176 210 247 287 330 376 425 477 532 590 651 715 pent = 782 p = 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 pent = 852 p = 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 pent = 925 p = 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 pent = 10292 pent = 10542 pent = 10795 pent = 11051 pent = 11310 pent = 11572 pent = 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 pent = 14950 pent = 15251 pent = 15555 pent = 15862 pent = 16172 pent = 16485 pent = 16801 pent = 17120 pent = 17442 pent = 17767 pent = 18095 pent = 18426 pent = 18760 pent = 19097 pent = 19437 pent = 19780 pent = 20126 pent = 20475 pent = 20827 pent = 21182 pent = 21540 pent = 21901 pent = 22265 pent = 22632 pent = 23002 pent = 23375 pent = 23751 pent = 24130 pent = 24512 pent = 24897 pent = 25285 pent = 25676 pent = 26070 pent = 26467 pent = 26867 pent = 27270 pent = 27676 pent = 28085 pent = 28497 pent = 28912 pent = 29330 pent = 29751 pent = 30175 pent = 30602 pent = 31032 pent = 31465 pent = 31901 pent = 32340 pent = 32782 pent = 33227 pent = 33675 pent = 34126 pent = 34580 pent = 35037 pent = 35497 pent = 35960 pent = 36426 pent = 36895 pent = 37367 pent = 37842 pent = 38320 pent = 38801 pent = 39285 pent = 39772 pent = 40262 pent = 40755 pent = 41251 pent = 41750 pent = 42252 pent = 42757 pent = 43265 pent = 43776 pent = 44290 pent = 44807 pent = 45327 pent = 45850 pent = 46376 pent = 46905 pent = 47437 pent = 47972 pent = 48510 pent = 49051 pent = 49595 pent = 50142 pent = 50692 pent = 51245 pent = 51801 pent = 52360 pent = 52922 pent = 53487 pent = 54055 pent = 54626 pent = 55200 pent = 55777 pent = 56357 pent = 56940 pent = 57526 pent = 58115 pent = 58707 pent = 59302 pent = 59900 pent = 60501 pent = 61105 pent = 61712 pent = 62322 pent = 62935 pent = 63551 pent = 64170 pent = 64792 pent = 65417 pent = 66045 pent = 66676 pent = 67310 pent = 67947 pent = 68587 pent = 69230 pent = 69876 pent = 70525 pent = 71177 pent = 71832 pent = 72490 pent = 73151 pent = 73815 pent = 74482 pent = 75152 pent = 75825 pent = 76501 pent = 77180 pent = 77862 pent = 78547 pent = 79235 pent = 79926 pent = 80620 pent = 81317 pent = 82017 pent = 82720 pent = 83426 pent = 84135 pent = 84847 pent = 85562 pent = 86280 pent = 87001 pent = 87725 pent = 88452 pent = 89182 pent = 89915 pent = 90651 pent = 91390 pent = 92132 pent = 92877 pent = 93625 pent = 94376 pent = 95130 pent = 95887 pent = 96647 pent = 97410 pent = 98176 pent = 98945 pent = 99717 pent = 100492 pent = 101270 pent = 102051 pent = 102835 pent = 103622 pent = 104412 pent = 105205 pent = 106001 pent = 106800 pent = 107602 pent = 108407 pent = 109215 pent = 110026 pent = 110840 pent = 111657 pent = 112477 pent = 113300 pent = 114126 pent = 114955 pent = 115787 pent = 116622 pent = 117460 pent = 118301 pent = 119145 pent = 119992 pent = 120842 pent = 121695 pent = 122551 pent = 123410 pent = 124272 pent = 125137 pent = 126005 pent = 126876 pent = 127750 pent = 128627 pent = 129507 pent = 130390 pent = 131276 pent = 132165 pent = 133057 pent = 133952 pent = 134850 pent = 135751 pent = 136655 pent = 137562 pent = 138472 pent = 139385 pent = 140301 pent = 141220 pent = 142142 pent = 143067 pent = 143995 pent = 144926 pent = 145860 pent = 146797 pent = 147737 pent = 148680 pent = 149626 pent = 150575 pent = 151527 pent = 152482 pent = 153440 pent = 154401 pent = 155365 pent = 156332 pent = 157302 pent = 158275 pent = 159251 pent = 160230 pent = 161212 pent = 162197 pent = 163185 pent = 164176 pent = 165170 pent = 166167 pent = 167167 pent = 168170 pent = 169176 pent = 170185 pent = 171197 pent = 172212 pent = 173230 pent = 174251 pent = 175275 pent = 176302 pent = 177332 pent = 178365 pent = 179401 pent = 180440 pent = 181482 pent = 182527 pent = 183575 pent = 184626 pent = 185680 pent = 186737 pent = 187797 pent = 188860 pent = 189926 pent = 190995 pent = 192067 pent = 193142 pent = 194220 pent = 195301 pent = 196385 pent = 197472 pent = 198562 pent = 199655 pent = 200751 pent = 201850 pent = 202952 pent = 204057 pent = 205165 pent = 206276 pent = 207390 pent = 208507 pent = 209627 pent = 210750 pent = 211876 pent = 213005 pent = 214137 pent = 215272 pent = 216410 pent = 217551 pent = 218695 pent = 219842 pent = 220992 pent = 222145 pent = 223301 pent = 224460 pent = 225622 pent = 226787 pent = 227955 pent = 229126 pent = 230300 pent = 231477 pent = 232657 pent = 23384...

6   Pass
x1 = 40; x2 = 50; [p,d] = pentagonal_numbers(x1,x2) assert(isempty(p)) assert(isempty(d))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 d = 0×0 empty logical array p = [] d = 0×0 empty logical array

7   Pass
x1 = 1000; x2 = 1500; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1001,1080,1162,1247,1335,1426])) assert(isequal(d,[0,1,0,0,1,0]))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 p = 1001 pent = 1080 p = 1001 1080 pent = 1162 p = 1001 1080 1162 pent = 1247 p = 1001 1080 1162 1247 pent = 1335 p = 1001 1080 1162 1247 1335 pent = 1426 p = 1001 1080 1162 1247 1335 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 pent = 10292 pent = 10542 pent = 10795 pent = 11051 pent = 11310 pent = 11572 pent = 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 pent = 14950 pent = 15251 pent = 15555 pent = 15862 pent = 16172 pent = 16485 pent = 16801 pent = 17120 pent = 17442 pent = 17767 pent = 18095 pent = 18426 pent = 18760 pent = 19097 pent = 19437 pent = 19780 pent = 20126 pent = 20475 pent = 20827 pent = 21182 pent = 21540 pent = 21901 pent = 22265 pent = 22632 pent = 23002 pent = 23375 pent = 23751 pent = 24130 pent = 24512 pent = 24897 pent = 25285 pent = 25676 pent = 26070 pent = 26467 pent = 26867 pent = 27270 pent = 27676 pent = 28085 pent = 28497 pent = 28912 pent = 29330 pent = 29751 pent = 30175 pent = 30602 pent = 31032 pent = 31465 pent = 31901 pent = 32340 pent = 32782 pent = 33227 pent = 33675 pent = 34126 pent = 34580 pent = 35037 pent = 35497 pent = 35960 pent = 36426 pent = 36895 pent = 37367 pent = 37842 pent = 38320 pent = 38801 pent = 39285 pent = 39772 pent = 40262 pent = 40755 pent = 41251 pent = 41750 pent = 42252 pent = 42757 pent = 43265 pent = 43776 pent = 44290 pent = 44807 pent = 45327 pent = 45850 pent = 46376 pent = 46905 pent = 47437 pent = 47972 pent = 48510 pent = 49051 pent = 49595 pent = 50142 pent = 50692 pent = 51245 pent = 51801 pent = 52360 pent = 52922 pent = 53487 pent = 54055 pent = 54626 pent = 55200 pent = 55777 pent = 56357 pent = 56940 pent = 57526 pent = 58115 pent = 58707 pent = 59302 pent = 59900 pent = 60501 pent = 61105 pent = 61712 pent = 62322 pent = 62935 pent = 63551 pent = 64170 pent = 64792 pent = 65417 pent = 66045 pent = 66676 pent = 67310 pent = 67947 pent = 68587 pent = 69230 pent = 69876 pent = 70525 pent = 71177 pent = 71832 pent = 72490 pent = 73151 pent = 73815 pent = 74482 pent = 75152 pent = 75825 pent = 76501 pent = 77180 pent = 77862 pent = 78547 pent = 79235 pent = 79926 pent = 80620 pent = 81317 pent = 82017 pent = 82720 pent = 83426 pent = 84135 pent = 84847 pent = 85562 pent = 86280 pent = 87001 pent = 87725 pent = 88452 pent = 89182 pent = 89915 pent = 90651 pent = 91390 pent = 92132 pent = 92877 pent = 93625 pent = 94376 pent = 95130 pent = 95887 pent = 96647 pent = 97410 pent = 98176 pent = 98945 pent = 99717 pent = 100492 pent = 101270 pent = 102051 pent = 102835 pent = 103622 pent = 104412 pent = 105205 pent = 106001 pent = 106800 pent = 107602 pent = 108407 pent = 109215 pent = 110026 pent = 110840 pent = 111657 pent = 112477 pent = 113300 pent = 114126 pent = 114955 pent = 115787 pent = 116622 pent = 117460 pent = 118301 pent = 119145 pent = 119992 pent = 120842 pent = 121695 pent = 122551 pent = 123410 pent = 124272 pent = 125137 pent = 126005 pent = 126876 pent = 127750 pent = 128627 pent = 129507 pent = 130390 pent = 131276 pent = 132165 pent = 133057 pent = 133952 pent = 134850 pent = 135751 pent = 136655 pent = 137562 pent = 138472 pent = 139385 pent = 140301 pent = 141220 pent = 142142 pent = 143067 pent = 143995 pent = 144926 pent = 145860 pent = 146797 pent = 147737 pent = 148680 pent = 149626 pent = 150575 pent = 151527 pent = 152482 pent = 153440 pent = 154401 pent = 155365 pent = 156332 pent = 157302 pent = 158275 pent = 159251 pent = 160230 pent = 161212 pent = 162197 pent = 163185 pent = 164176 pent = 165170 pent = 166167 pent = 167167 pent = 168170 pent = 169176 pent = 170185 pent = 171197 pent = 172212 pent = 173230 pent = 174251 pent = 175275 pent = 176302 pent = 177332 pent = 178365 pent = 179401 pent = 180440 pent = 181482 pent = 182527 pent = 183575 pent = 184626 pent = 185680 pent = 186737 pent = 187797 pent = 188860 pent = 189926 pent = 190995 pent = 192067 pent = 193142 pent = 194220 pent = 195301 pent = 196385 pent = 197472 pent = 198562 pent = 199655 pent = 200751 pent = 201850 pent = 202952 pent = 204057 pent = 205165 pent = 206276 pent = 207390 pent = 208507 pent = 209627 pent = 210750 pent = 211876 pent = 213005 pent = 214137 pent = 215272 pent = 216410 pent = 217551 pent = 218695 pent = 219842 pent = 220992 pent = 222145 pent = 223301 pent = 224460 pent = 225622 pent = 226787 pent = 227955 pent = 229126 pent = 230300 pent = 231477 pent = 232657 pent = 233840 pent = 235026 pent = 236215 pent = 237407 pent = 238602 pent = 239800 pent = 241001 pent = 242205 pent = 243412 pent = 244622 pent = 245835 pent = 247051 pent = 248270 pent = 249492 pent = 250717 pent = 251945 pent = 253176 pent = 254410 pent = 255647 pent = 256887 pent = 258130 pent = 259376 pent = 260625 pent = 261877 pent = 263132 pent = 264390 pent = 265651 pent = 266915 pent = 268182 pent = 269452 pent = 270725 pent = 272001 pent = 273280 pent = ...

8   Pass
x1 = 1500; x2 = 3000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882])) assert(isequal(d,[1,0,0,1,0,1,0,0,1,0,1,0,0]))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 p = 1520 pent = 1617 p = 1520 1617 pent = 1717 p = 1520 1617 1717 pent = 1820 p = 1520 1617 1717 1820 pent = 1926 p = 1520 1617 1717 1820 1926 pent = 2035 p = 1520 1617 1717 1820 1926 2035 pent = 2147 p = 1520 1617 1717 1820 1926 2035 2147 pent = 2262 p = 1520 1617 1717 1820 1926 2035 2147 2262 pent = 2380 p = 1520 1617 1717 1820 1926 2035 2147 2262 2380 pent = 2501 p = 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 pent = 2625 p = 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 pent = 2752 p = 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 2752 pent = 2882 p = 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 2752 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 pent = 10292 pent = 10542 pent = 10795 pent = 11051 pent = 11310 pent = 11572 pent = 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 pent = 14950 pent = 15251 pent = 15555 pent = 15862 pent = 16172 pent = 16485 pent = 16801 pent = 17120 pent = 17442 pent = 17767 pent = 18095 pent = 18426 pent = 18760 pent = 19097 pent = 19437 pent = 19780 pent = 20126 pent = 20475 pent = 20827 pent = 21182 pent = 21540 pent = 21901 pent = 22265 pent = 22632 pent = 23002 pent = 23375 pent = 23751 pent = 24130 pent = 24512 pent = 24897 pent = 25285 pent = 25676 pent = 26070 pent = 26467 pent = 26867 pent = 27270 pent = 27676 pent = 28085 pent = 28497 pent = 28912 pent = 29330 pent = 29751 pent = 30175 pent = 30602 pent = 31032 pent = 31465 pent = 31901 pent = 32340 pent = 32782 pent = 33227 pent = 33675 pent = 34126 pent = 34580 pent = 35037 pent = 35497 pent = 35960 pent = 36426 pent = 36895 pent = 37367 pent = 37842 pent = 38320 pent = 38801 pent = 39285 pent = 39772 pent = 40262 pent = 40755 pent = 41251 pent = 41750 pent = 42252 pent = 42757 pent = 43265 pent = 43776 pent = 44290 pent = 44807 pent = 45327 pent = 45850 pent = 46376 pent = 46905 pent = 47437 pent = 47972 pent = 48510 pent = 49051 pent = 49595 pent = 50142 pent = 50692 pent = 51245 pent = 51801 pent = 52360 pent = 52922 pent = 53487 pent = 54055 pent = 54626 pent = 55200 pent = 55777 pent = 56357 pent = 56940 pent = 57526 pent = 58115 pent = 58707 pent = 59302 pent = 59900 pent = 60501 pent = 61105 pent = 61712 pent = 62322 pent = 62935 pent = 63551 pent = 64170 pent = 64792 pent = 65417 pent = 66045 pent = 66676 pent = 67310 pent = 67947 pent = 68587 pent = 69230 pent = 69876 pent = 70525 pent = 71177 pent = 71832 pent = 72490 pent = 73151 pent = 73815 pent = 74482 pent = 75152 pent = 75825 pent = 76501 pent = 77180 pent = 77862 pent = 78547 pent = 79235 pent = 79926 pent = 80620 pent = 81317 pent = 82017 pent = 82720 pent = 83426 pent = 84135 pent = 84847 pent = 85562 pent = 86280 pent = 87001 pent = 87725 pent = 88452 pent = 89182 pent = 89915 pent = 90651 pent = 91390 pent = 92132 pent = 92877 pent = 93625 pent = 94376 pent = 95130 pent = 95887 pent = 96647 pent = 97410 pent = 98176 pent = 98945 pent = 99717 pent = 100492 pent = 101270 pent = 102051 pent = 102835 pent = 103622 pent = 104412 pent = 105205 pent = 106001 pent = 106800 pent = 107602 pent = 108407 pent = 109215 pent = 110026 pent = 110840 pent = 111657 pent = 112477 pent = 113300 pent = 114126 pent = 114955 pent = 115787 pent = 116622 pent = 117460 pent = 118301 pent = 119145 pent = 119992 pent = 120842 pent = 121695 pent = 122551 pent = 123410 pent = 124272 pent = 125137 pent = 126005 pent = 126876 pent = 127750 pent = 128627 pent = 129507 pent = 130390 pent = 131276 pent = 132165 pent = 133057 pent = 133952 pent = 134850 pent = 135751 pent = 136655 pent = 137562 pent = 138472 pent = 139385 pent = 140301 pent = 141220 pent = 142142 pent = 143067 pent = 143995 pent = 144926 pent = 145860 pent = 146797 pent = 147737 pent = 148680 pent = 149626 pent = 150575 pent = 151527 pent = 152482 pent = 153440 pent = 154401 pent = 155365 pent = 156332 pent = 157302 pent = 158275 pent = 159251 pent = 160230 pent = 161212 pent = 162197 pent = 163185 pent = 164176 pent = 165170 pent = 166167 pent = 167167 pent = 168170 pent = 169176 pent = 170185 pent = 171197 pent = 172212 pent = 173230 pent = 174251 pent = 175275 pent = 176302 pent = 177332 pent = 178365 pent = 179401 pent = 180440 pent = 181482 pent = 182527 pent = 183575 pent = 184626 pent = 185680 pent = 186737 pent = 187797 pent = 188860 pent = 189926 pent = 190995 pent = 192067 pent = 193142 pent = 194220 pent = 195301 pent = 196385 pent = 197472 pent = 198562 pent = 199655 pent = 200751 pent = 201850 pent = 202952 pent = 204057 pent = 205165 pent = 206276 pent = 207390 pent = 208507 pent = 209627 pent = 210750 pent = 211876 pent = 213005 pent = 214137 pent = 215272 pent = 216410 pent = 217551 pent = 218695 pent = 219842 pent = 220992 pent = 222145 pent = 223301 pent = 224460 pent = 225622 pent = 2...

9   Pass
x1 = 1; x2 = 3000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882])) assert(isequal(d,[0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0]))

p = [] pent = 1 p = 1 pent = 5 p = 1 5 pent = 12 p = 1 5 12 pent = 22 p = 1 5 12 22 pent = 35 p = 1 5 12 22 35 pent = 51 p = 1 5 12 22 35 51 pent = 70 p = 1 5 12 22 35 51 70 pent = 92 p = 1 5 12 22 35 51 70 92 pent = 117 p = 1 5 12 22 35 51 70 92 117 pent = 145 p = 1 5 12 22 35 51 70 92 117 145 pent = 176 p = 1 5 12 22 35 51 70 92 117 145 176 pent = 210 p = 1 5 12 22 35 51 70 92 117 145 176 210 pent = 247 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 pent = 287 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 pent = 330 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 pent = 376 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 pent = 425 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 pent = 477 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 pent = 532 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 pent = 590 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 pent = 651 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 pent = 715 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 pent = 782 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 pent = 852 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 pent = 925 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 pent = 1001 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 26 376 425 477 532 590 651 715 782 852 925 1001 pent = 1080 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 27 376 425 477 532 590 651 715 782 852 925 1001 1080 pent = 1162 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 28 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 pent = 1247 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 29 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 pent = 1335 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 pent = 1426 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Column 31 1426 pent = 1520 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 32 1426 1520 pent = 1617 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 33 1426 1520 1617 pent = 1717 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 34 1426 1520 1617 1717 pent = 1820 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 35 1426 1520 1617 1717 1820 pent = 1926 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 36 1426 1520 1617 1717 1820 1926 pent = 2035 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 37 1426 1520 1617 1717 1820 1926 2035 pent = 2147 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 38 1426 1520 1617 1717 1820 1926 2035 2147 pent = 2262 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 39 1426 1520 1617 1717 1820 1926 2035 2147 2262 pent = 2380 p = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 40 1426 1520 1617 1717 1820 1926 2035 2147 2...

10   Pass
x1 = 10000; x2 = 12000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[10045,10292,10542,10795,11051,11310,11572,11837])) assert(isequal(d,[1,0,0,1,0,1,0,0]))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 p = 10045 pent = 10292 p = 10045 10292 pent = 10542 p = 10045 10292 10542 pent = 10795 p = 10045 10292 10542 10795 pent = 11051 p = 10045 10292 10542 10795 11051 pent = 11310 p = 10045 10292 10542 10795 11051 11310 pent = 11572 p = 10045 10292 10542 10795 11051 11310 11572 pent = 11837 p = 10045 10292 10542 10795 11051 11310 11572 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 pent = 14950 pent = 15251 pent = 15555 pent = 15862 pent = 16172 pent = 16485 pent = 16801 pent = 17120 pent = 17442 pent = 17767 pent = 18095 pent = 18426 pent = 18760 pent = 19097 pent = 19437 pent = 19780 pent = 20126 pent = 20475 pent = 20827 pent = 21182 pent = 21540 pent = 21901 pent = 22265 pent = 22632 pent = 23002 pent = 23375 pent = 23751 pent = 24130 pent = 24512 pent = 24897 pent = 25285 pent = 25676 pent = 26070 pent = 26467 pent = 26867 pent = 27270 pent = 27676 pent = 28085 pent = 28497 pent = 28912 pent = 29330 pent = 29751 pent = 30175 pent = 30602 pent = 31032 pent = 31465 pent = 31901 pent = 32340 pent = 32782 pent = 33227 pent = 33675 pent = 34126 pent = 34580 pent = 35037 pent = 35497 pent = 35960 pent = 36426 pent = 36895 pent = 37367 pent = 37842 pent = 38320 pent = 38801 pent = 39285 pent = 39772 pent = 40262 pent = 40755 pent = 41251 pent = 41750 pent = 42252 pent = 42757 pent = 43265 pent = 43776 pent = 44290 pent = 44807 pent = 45327 pent = 45850 pent = 46376 pent = 46905 pent = 47437 pent = 47972 pent = 48510 pent = 49051 pent = 49595 pent = 50142 pent = 50692 pent = 51245 pent = 51801 pent = 52360 pent = 52922 pent = 53487 pent = 54055 pent = 54626 pent = 55200 pent = 55777 pent = 56357 pent = 56940 pent = 57526 pent = 58115 pent = 58707 pent = 59302 pent = 59900 pent = 60501 pent = 61105 pent = 61712 pent = 62322 pent = 62935 pent = 63551 pent = 64170 pent = 64792 pent = 65417 pent = 66045 pent = 66676 pent = 67310 pent = 67947 pent = 68587 pent = 69230 pent = 69876 pent = 70525 pent = 71177 pent = 71832 pent = 72490 pent = 73151 pent = 73815 pent = 74482 pent = 75152 pent = 75825 pent = 76501 pent = 77180 pent = 77862 pent = 78547 pent = 79235 pent = 79926 pent = 80620 pent = 81317 pent = 82017 pent = 82720 pent = 83426 pent = 84135 pent = 84847 pent = 85562 pent = 86280 pent = 87001 pent = 87725 pent = 88452 pent = 89182 pent = 89915 pent = 90651 pent = 91390 pent = 92132 pent = 92877 pent = 93625 pent = 94376 pent = 95130 pent = 95887 pent = 96647 pent = 97410 pent = 98176 pent = 98945 pent = 99717 pent = 100492 pent = 101270 pent = 102051 pent = 102835 pent = 103622 pent = 104412 pent = 105205 pent = 106001 pent = 106800 pent = 107602 pent = 108407 pent = 109215 pent = 110026 pent = 110840 pent = 111657 pent = 112477 pent = 113300 pent = 114126 pent = 114955 pent = 115787 pent = 116622 pent = 117460 pent = 118301 pent = 119145 pent = 119992 pent = 120842 pent = 121695 pent = 122551 pent = 123410 pent = 124272 pent = 125137 pent = 126005 pent = 126876 pent = 127750 pent = 128627 pent = 129507 pent = 130390 pent = 131276 pent = 132165 pent = 133057 pent = 133952 pent = 134850 pent = 135751 pent = 136655 pent = 137562 pent = 138472 pent = 139385 pent = 140301 pent = 141220 pent = 142142 pent = 143067 pent = 143995 pent = 144926 pent = 145860 pent = 146797 pent = 147737 pent = 148680 pent = 149626 pent = 150575 pent = 151527 pent = 152482 pent = 153440 pent = 154401 pent = 155365 pent = 156332 pent = 157302 pent = 158275 pent = 159251 pent = 160230 pent = 161212 pent = 162197 pent = 163185 pent = 164176 pent = 165170 pent = 166167 pent = 167167 pent = 168170 pent = 169176 pent = 170185 pent = 171197 pent = 172212 pent = 173230 pent = 174251 pent = 175275 pent = 176302 pent = 177332 pent = 178365 pent = 179401 pent = 180440 pent = 181482 pent = 182527 pent = 183575 pent = 184626 pent = 185680 pent = 186737 pent = 187797 pent = 188860 pent = 189926 pent = 190995 pent = 192067 pent = 193142 pent = 194220 pent = 195301 pent = 196385 pent = 197472 pent = 198562 pent = 199655 pent = 200751 pent = 201850 pent = 202952 pent = 204057 pent = 205165 pent = 206276 pent = 207390 pent = 208507 pent = 209627 pent = 210750 pent = 211876 pent = 213005 pent = 214137 pent = 215272 pent = 216410 pent = 217551 pent = 218695 pent = 219842 pent = 220992 pent = 222145 pent = 223301 pent = 224460 pent = 225622 pent = 226787 pent = 227955 pent = 229126 pent = 230300 pent = 231477 pent = 232657 pent = 233840 pent = 235026 pent = 236215 pent = 237407 pent = 238602 pent = 239800 pent = 241001 pent = 242205 pent = 243412 pent = 244622 pent = 245835 pent = 247051 pent = 248270 pent = 249492 pent = 250717 pent = 251945 pent = 253176 pent = 254410 pent = 255647 pent = 256887 pent = 258130 pent = 259376 pent = 260625 pent = 261877 pent = 263132 pe...

11   Pass
x1 = 100000; x2 = 110000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[100492,101270,102051,102835,103622,104412,105205,106001,106800,107602,108407,109215])) assert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1]))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 pent = 10292 pent = 10542 pent = 10795 pent = 11051 pent = 11310 pent = 11572 pent = 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 pent = 14950 pent = 15251 pent = 15555 pent = 15862 pent = 16172 pent = 16485 pent = 16801 pent = 17120 pent = 17442 pent = 17767 pent = 18095 pent = 18426 pent = 18760 pent = 19097 pent = 19437 pent = 19780 pent = 20126 pent = 20475 pent = 20827 pent = 21182 pent = 21540 pent = 21901 pent = 22265 pent = 22632 pent = 23002 pent = 23375 pent = 23751 pent = 24130 pent = 24512 pent = 24897 pent = 25285 pent = 25676 pent = 26070 pent = 26467 pent = 26867 pent = 27270 pent = 27676 pent = 28085 pent = 28497 pent = 28912 pent = 29330 pent = 29751 pent = 30175 pent = 30602 pent = 31032 pent = 31465 pent = 31901 pent = 32340 pent = 32782 pent = 33227 pent = 33675 pent = 34126 pent = 34580 pent = 35037 pent = 35497 pent = 35960 pent = 36426 pent = 36895 pent = 37367 pent = 37842 pent = 38320 pent = 38801 pent = 39285 pent = 39772 pent = 40262 pent = 40755 pent = 41251 pent = 41750 pent = 42252 pent = 42757 pent = 43265 pent = 43776 pent = 44290 pent = 44807 pent = 45327 pent = 45850 pent = 46376 pent = 46905 pent = 47437 pent = 47972 pent = 48510 pent = 49051 pent = 49595 pent = 50142 pent = 50692 pent = 51245 pent = 51801 pent = 52360 pent = 52922 pent = 53487 pent = 54055 pent = 54626 pent = 55200 pent = 55777 pent = 56357 pent = 56940 pent = 57526 pent = 58115 pent = 58707 pent = 59302 pent = 59900 pent = 60501 pent = 61105 pent = 61712 pent = 62322 pent = 62935 pent = 63551 pent = 64170 pent = 64792 pent = 65417 pent = 66045 pent = 66676 pent = 67310 pent = 67947 pent = 68587 pent = 69230 pent = 69876 pent = 70525 pent = 71177 pent = 71832 pent = 72490 pent = 73151 pent = 73815 pent = 74482 pent = 75152 pent = 75825 pent = 76501 pent = 77180 pent = 77862 pent = 78547 pent = 79235 pent = 79926 pent = 80620 pent = 81317 pent = 82017 pent = 82720 pent = 83426 pent = 84135 pent = 84847 pent = 85562 pent = 86280 pent = 87001 pent = 87725 pent = 88452 pent = 89182 pent = 89915 pent = 90651 pent = 91390 pent = 92132 pent = 92877 pent = 93625 pent = 94376 pent = 95130 pent = 95887 pent = 96647 pent = 97410 pent = 98176 pent = 98945 pent = 99717 pent = 100492 p = 100492 pent = 101270 p = 100492 101270 pent = 102051 p = 100492 101270 102051 pent = 102835 p = 100492 101270 102051 102835 pent = 103622 p = 100492 101270 102051 102835 103622 pent = 104412 p = 100492 101270 102051 102835 103622 104412 pent = 105205 p = 100492 101270 102051 102835 103622 104412 105205 pent = 106001 p = 100492 101270 102051 102835 103622 104412 105205 106001 pent = 106800 p = 100492 101270 102051 102835 103622 104412 105205 106001 106800 pent = 107602 p = 100492 101270 102051 102835 103622 104412 105205 106001 106800 107602 pent = 108407 p = 100492 101270 102051 102835 103622 104412 105205 106001 106800 107602 108407 pent = 109215 p = 100492 101270 102051 102835 103622 104412 105205 106001 106800 107602 108407 109215 pent = 110026 pent = 110840 pent = 111657 pent = 112477 pent = 113300 pent = 114126 pent = 114955 pent = 115787 pent = 116622 pent = 117460 pent = 118301 pent = 119145 pent = 119992 pent = 120842 pent = 121695 pent = 122551 pent = 123410 pent = 124272 pent = 125137 pent = 126005 pent = 126876 pent = 127750 pent = 128627 pent = 129507 pent = 130390 pent = 131276 pent = 132165 pent = 133057 pent = 133952 pent = 134850 pent = 135751 pent = 136655 pent = 137562 pent = 138472 pent = 139385 pent = 140301 pent = 141220 pent = 142142 pent = 143067 pent = 143995 pent = 144926 pent = 145860 pent = 146797 pent = 147737 pent = 148680 pent = 149626 pent = 150575 pent = 151527 pent = 152482 pent = 153440 pent = 154401 pent = 155365 pent = 156332 pent = 157302 pent = 158275 pent = 159251 pent = 160230 pent = 161212 pent = 162197 pent = 163185 pent = 164176 pent = 165170 pent = 166167 pent = 167167 pent = 168170 pent = 169176 pent = 170185 pent = 171197 pent = 172212 pent = 173230 pent = 174251 pent = 175275 pent = 176302 pent = 177332 pent = 178365 pent = 179401 pent = 180440 pent = 181482 pent = 182527 pent = 183575 pent = 184626 pent = 185680 pent = 186737 pent = 187797 pent = 188860 pent = 189926 pent = 190995 pent = 192067 pent = 193142 pent = 194220 pent = 195301 pent = 196385 pent = 197472 pent = 198562 pent = 199655 pent = 200751 pent = 201850 pent = 202952 pent = 204057 pent = 205165 pent = 206276 pent = 207390 pent = 208507 pent = 209627 pent = 210750 pent = 211876 pent = 213005 pent = 214137 pent = 215272 pent = 216410 pent = 217551 pent = 218695 pent = 219842 pent = 220992 pent = 222145 pent = 223301 pent = 224460 pent = 225622 pent = 226787 pent = 227955 pent = 229126 pent = 230300 pent = 231477 pent = 232657 pent = 233840 pent = 2350...

12   Pass
x1 = 1000000; x2 = 1010101; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1000825,1003277,1005732,1008190])) assert(isequal(d,[1,0,0,1]))

p = [] pent = 1 pent = 5 pent = 12 pent = 22 pent = 35 pent = 51 pent = 70 pent = 92 pent = 117 pent = 145 pent = 176 pent = 210 pent = 247 pent = 287 pent = 330 pent = 376 pent = 425 pent = 477 pent = 532 pent = 590 pent = 651 pent = 715 pent = 782 pent = 852 pent = 925 pent = 1001 pent = 1080 pent = 1162 pent = 1247 pent = 1335 pent = 1426 pent = 1520 pent = 1617 pent = 1717 pent = 1820 pent = 1926 pent = 2035 pent = 2147 pent = 2262 pent = 2380 pent = 2501 pent = 2625 pent = 2752 pent = 2882 pent = 3015 pent = 3151 pent = 3290 pent = 3432 pent = 3577 pent = 3725 pent = 3876 pent = 4030 pent = 4187 pent = 4347 pent = 4510 pent = 4676 pent = 4845 pent = 5017 pent = 5192 pent = 5370 pent = 5551 pent = 5735 pent = 5922 pent = 6112 pent = 6305 pent = 6501 pent = 6700 pent = 6902 pent = 7107 pent = 7315 pent = 7526 pent = 7740 pent = 7957 pent = 8177 pent = 8400 pent = 8626 pent = 8855 pent = 9087 pent = 9322 pent = 9560 pent = 9801 pent = 10045 pent = 10292 pent = 10542 pent = 10795 pent = 11051 pent = 11310 pent = 11572 pent = 11837 pent = 12105 pent = 12376 pent = 12650 pent = 12927 pent = 13207 pent = 13490 pent = 13776 pent = 14065 pent = 14357 pent = 14652 pent = 14950 pent = 15251 pent = 15555 pent = 15862 pent = 16172 pent = 16485 pent = 16801 pent = 17120 pent = 17442 pent = 17767 pent = 18095 pent = 18426 pent = 18760 pent = 19097 pent = 19437 pent = 19780 pent = 20126 pent = 20475 pent = 20827 pent = 21182 pent = 21540 pent = 21901 pent = 22265 pent = 22632 pent = 23002 pent = 23375 pent = 23751 pent = 24130 pent = 24512 pent = 24897 pent = 25285 pent = 25676 pent = 26070 pent = 26467 pent = 26867 pent = 27270 pent = 27676 pent = 28085 pent = 28497 pent = 28912 pent = 29330 pent = 29751 pent = 30175 pent = 30602 pent = 31032 pent = 31465 pent = 31901 pent = 32340 pent = 32782 pent = 33227 pent = 33675 pent = 34126 pent = 34580 pent = 35037 pent = 35497 pent = 35960 pent = 36426 pent = 36895 pent = 37367 pent = 37842 pent = 38320 pent = 38801 pent = 39285 pent = 39772 pent = 40262 pent = 40755 pent = 41251 pent = 41750 pent = 42252 pent = 42757 pent = 43265 pent = 43776 pent = 44290 pent = 44807 pent = 45327 pent = 45850 pent = 46376 pent = 46905 pent = 47437 pent = 47972 pent = 48510 pent = 49051 pent = 49595 pent = 50142 pent = 50692 pent = 51245 pent = 51801 pent = 52360 pent = 52922 pent = 53487 pent = 54055 pent = 54626 pent = 55200 pent = 55777 pent = 56357 pent = 56940 pent = 57526 pent = 58115 pent = 58707 pent = 59302 pent = 59900 pent = 60501 pent = 61105 pent = 61712 pent = 62322 pent = 62935 pent = 63551 pent = 64170 pent = 64792 pent = 65417 pent = 66045 pent = 66676 pent = 67310 pent = 67947 pent = 68587 pent = 69230 pent = 69876 pent = 70525 pent = 71177 pent = 71832 pent = 72490 pent = 73151 pent = 73815 pent = 74482 pent = 75152 pent = 75825 pent = 76501 pent = 77180 pent = 77862 pent = 78547 pent = 79235 pent = 79926 pent = 80620 pent = 81317 pent = 82017 pent = 82720 pent = 83426 pent = 84135 pent = 84847 pent = 85562 pent = 86280 pent = 87001 pent = 87725 pent = 88452 pent = 89182 pent = 89915 pent = 90651 pent = 91390 pent = 92132 pent = 92877 pent = 93625 pent = 94376 pent = 95130 pent = 95887 pent = 96647 pent = 97410 pent = 98176 pent = 98945 pent = 99717 pent = 100492 pent = 101270 pent = 102051 pent = 102835 pent = 103622 pent = 104412 pent = 105205 pent = 106001 pent = 106800 pent = 107602 pent = 108407 pent = 109215 pent = 110026 pent = 110840 pent = 111657 pent = 112477 pent = 113300 pent = 114126 pent = 114955 pent = 115787 pent = 116622 pent = 117460 pent = 118301 pent = 119145 pent = 119992 pent = 120842 pent = 121695 pent = 122551 pent = 123410 pent = 124272 pent = 125137 pent = 126005 pent = 126876 pent = 127750 pent = 128627 pent = 129507 pent = 130390 pent = 131276 pent = 132165 pent = 133057 pent = 133952 pent = 134850 pent = 135751 pent = 136655 pent = 137562 pent = 138472 pent = 139385 pent = 140301 pent = 141220 pent = 142142 pent = 143067 pent = 143995 pent = 144926 pent = 145860 pent = 146797 pent = 147737 pent = 148680 pent = 149626 pent = 150575 pent = 151527 pent = 152482 pent = 153440 pent = 154401 pent = 155365 pent = 156332 pent = 157302 pent = 158275 pent = 159251 pent = 160230 pent = 161212 pent = 162197 pent = 163185 pent = 164176 pent = 165170 pent = 166167 pent = 167167 pent = 168170 pent = 169176 pent = 170185 pent = 171197 pent = 172212 pent = 173230 pent = 174251 pent = 175275 pent = 176302 pent = 177332 pent = 178365 pent = 179401 pent = 180440 pent = 181482 pent = 182527 pent = 183575 pent = 184626 pent = 185680 pent = 186737 pent = 187797 pent = 188860 pent = 189926 pent = 190995 pent = 192067 pent = 193142 pent = 194220 pent = 195301 pent = 196385 pent = 197472 pent = 198562 pent = 199655 pent = 200751 pent = 201850 pent = 202952 pent = 204057 pent = 205165 pent = 206276 pent = 207390 pent = 208507 pent = 209627 pent = 210750 pent = 211876 pent = 213005 pent = 214137 pent = 215272 pent = 216410 pent = 217551 pent = 218695 pent = 219842 pent = 220992 pent = 222145 pent = 223301 pent = 224460 pent = 225622 pent = 226787 pent = 227955 pent = 229126 pent = 230300 pent = 231477 pent = 232657 pent = 233840 pent = 235026 pent = 236215 pent = 237407 pent = 238602 pent = 239800 pent = 241001 pent = 242205 pent = 243412 pent = 244622 pent = 245835 pent = 247051 pent = 248270 pent = 249492 pent = 250717 pent = 251945 pent = 253176 pent = 254410 pent = 255647 pent = 256887 pent = 258130 pent = 259376 pent = 260625 pent = 261877 pent = 263132 pent = 264390 pent = 265651 pent = 266915 pent = 268182 pent = 269452 pent = 270725 pent = 272001 pent = 273280 pent = 274562 pent = 275847 pent = 277135 pent = 278426 pent = 279720 pent = 281017 pent = 282317 pent = 283620 pent = 284926 pent = 286235 pent = 287547 pent = 288862 pent = 290180 pent = 2...