Day 09 Part 2 Complete

This commit is contained in:
Luke Else 2023-12-09 14:07:04 +00:00
parent 5627684494
commit a4c8d73439
5 changed files with 286 additions and 8 deletions

View File

@ -0,0 +1,200 @@
8 27 61 121 232 446 858 1625 2988 5297 9039 14869 23644 36460 54692 80037 114560 160743 221537 300417 401440
8 8 3 -9 -26 -26 63 410 1348 3464 7715 15573 29202 51670 87199 141456 221888 338104 502307 729779 1039422
7 20 43 80 131 192 255 308 335 316 227 40 -277 -760 -1449 -2388 -3625 -5212 -7205 -9664 -12653
1 11 33 75 142 243 413 770 1657 3978 9939 24564 58586 133628 291003 605989 1210089 2324581 4309613 7734217 13473918
7 8 8 18 62 184 460 1013 2029 3772 6596 10952 17388 26540 39112 55843 77459 104608 137776 177182 222650
9 31 75 150 263 424 660 1045 1753 3141 5869 11064 20535 37046 64654 109119 178393 283195 437679 660202 974199
4 7 19 62 177 445 1034 2302 5014 10768 22769 47137 94972 185401 349778 637136 1121123 1909658 3162034 5127705 8243746
11 19 27 35 43 51 59 67 75 83 91 99 107 115 123 131 139 147 155 163 171
-3 -2 0 3 7 12 18 25 33 42 52 63 75 88 102 117 133 150 168 187 207
16 28 60 120 221 394 706 1295 2444 4734 9352 18704 37635 75858 152752 306665 612472 1213680 2379212 4600600 8753233
21 36 58 101 195 405 867 1858 3940 8257 17135 35267 72013 145829 292823 583461 1155531 2279398 4486268 8816173 17286483
11 15 30 65 125 208 302 382 407 317 30 -561 -1591 -3226 -5666 -9148 -13949 -20389 -28834 -39699 -53451
22 44 82 146 245 380 528 613 460 -272 -2182 -6248 -13981 -27616 -50344 -86589 -142334 -225500 -346382 -518146 -757391
19 45 90 160 261 399 580 810 1095 1441 1854 2340 2905 3555 4296 5134 6075 7125 8290 9576 10989
8 7 19 68 192 440 881 1641 2996 5574 10757 21433 43363 87695 175797 349068 689707 1365587 2727387 5516639 11303487
25 45 83 153 274 474 793 1280 1986 2984 4525 7610 15598 38113 99693 257747 638165 1503651 3381938 7303150 15236734
15 30 73 169 364 736 1417 2646 4892 9119 17317 33499 65469 127805 246679 467358 865501 1563692 2755033 4736069 7951834
9 16 39 93 197 379 696 1288 2496 5091 10702 22627 47406 97886 199085 399048 788179 1532338 2927433 5486449 10073987
16 25 38 66 146 350 804 1736 3586 7243 14542 29286 59292 120344 243528 488292 964796 1870781 3550390 6585226 11931550
7 21 51 100 173 277 421 616 875 1213 1647 2196 2881 3725 4753 5992 7471 9221 11275 13668 16437
10 14 30 69 135 232 385 676 1299 2647 5459 11076 21882 42039 78664 143641 256312 447348 764164 1278311 2095353
6 16 22 36 81 187 386 715 1256 2273 4547 10070 23370 53970 120956 261531 547038 1112622 2210968 4307040 8240259
3 24 57 108 192 336 599 1120 2207 4497 9263 19037 38875 78824 158472 314879 615703 1179922 2209089 4032202 7166254
11 10 9 4 -12 -38 -45 49 406 1298 3150 6622 12781 23450 41870 73875 129861 227930 398711 692504 1189562
4 22 62 147 314 632 1237 2385 4533 8487 15722 29120 54661 105161 208165 421834 865466 1775620 3605246 7192473 14038628
1 1 5 13 25 51 128 353 963 2541 6528 16414 40328 96357 222999 499077 1080929 2271065 4644095 9276599 18164343
11 8 0 -15 -29 -12 100 417 1107 2408 4640 8217 13659 21604 32820 48217 68859 95976 130976 175457 231219
-2 5 23 65 172 437 1039 2287 4674 8941 16151 27773 45776 72733 111935 167515 244582 349365 489367 673529 912404
-3 13 45 94 161 247 353 480 629 801 997 1218 1465 1739 2041 2372 2733 3125 3549 4006 4497
12 16 26 51 103 202 405 870 1965 4434 9640 19935 39296 74578 138165 253576 466866 868644 1634430 3095131 5854885
9 6 14 44 107 214 376 604 909 1302 1794 2396 3119 3974 4972 6124 7441 8934 10614 12492 14579
23 31 36 38 37 33 26 16 3 -13 -32 -54 -79 -107 -138 -172 -209 -249 -292 -338 -387
20 30 37 49 93 236 618 1497 3306 6722 12747 22801 38827 63408 99896 152553 226704 328902 467105 650865 891529
15 22 19 4 -10 32 278 1049 2963 7144 15599 31916 62582 119574 225741 426501 815770 1593226 3188564 6524862 13563153
-1 4 18 53 133 297 614 1238 2550 5463 12010 26399 56808 118312 237488 459438 858209 1551878 2723914 4652833 7752631
17 27 49 107 239 500 965 1732 2925 4697 7233 10753 15515 21818 30005 40466 53641 70023 90161 114663 144199
11 33 71 137 252 464 874 1666 3142 5780 10383 18514 33688 64313 130245 276161 596940 1283361 2702081 5535642 11034321
-1 -1 8 43 125 290 622 1325 2857 6155 12986 26465 51787 97226 175460 305287 513803 839119 1333700 2068415 3137393
1 3 11 31 74 162 348 758 1664 3598 7518 15038 28735 52547 92277 156219 255923 407117 630805 954561 1414040
19 31 44 65 116 241 520 1109 2336 4892 10165 20791 41584 81243 155758 295456 559429 1064049 2036886 3914209 7510104
-5 -3 16 64 153 295 502 786 1159 1633 2220 2932 3781 4779 5938 7270 8787 10501 12424 14568 16945
17 43 91 178 329 579 975 1578 2465 3731 5491 7882 11065 15227 20583 27378 35889 46427 59339 75010 93865
12 22 42 71 108 152 202 257 316 378 442 507 572 636 698 757 812 862 906 943 972
9 17 36 66 107 159 222 296 381 477 584 702 831 971 1122 1284 1457 1641 1836 2042 2259
-8 -4 8 38 118 310 719 1514 2964 5509 9908 17537 30950 54865 97795 174611 310400 546066 946216 1609976 2685494
15 39 72 114 165 225 294 372 459 555 660 774 897 1029 1170 1320 1479 1647 1824 2010 2205
17 30 57 116 239 486 977 1956 3906 7735 15062 28676 53381 97817 178780 331735 635984 1272841 2654580 5698117 12381760
11 20 29 38 47 56 65 74 83 92 101 110 119 128 137 146 155 164 173 182 191
23 31 43 78 163 331 620 1070 1721 2641 4080 6998 14541 35712 93820 244839 615515 1479569 3405609 7537760 16119327
-2 -4 -12 -13 24 156 485 1195 2629 5473 11209 23182 48965 105312 228041 491002 1041486 2165356 4406665 8789322 17233490
1 10 28 52 79 106 130 148 157 154 136 100 43 -38 -146 -284 -455 -662 -908 -1196 -1529
26 50 100 200 394 756 1412 2587 4690 8450 15116 26734 46514 79300 132156 215081 341866 531106 807380 1202612 1757626
17 32 56 97 167 294 559 1185 2713 6313 14306 31027 64265 127742 245589 460825 851908 1565171 2877195 5310650 9840018
29 57 105 177 287 471 799 1387 2409 4109 6813 10941 17019 25691 37731 54055 75733 104001 140273 186153 243447
16 15 12 12 21 41 66 88 140 442 1781 6363 19573 53489 133872 314165 703559 1522604 3210805 6628261 13420152
20 40 68 107 160 230 320 433 572 740 940 1175 1448 1762 2120 2525 2980 3488 4052 4675 5360
7 22 57 129 268 539 1085 2213 4558 9383 19132 38501 76634 151785 301268 602352 1214945 2466051 5011629 10137742 20306500
11 13 25 51 103 211 439 909 1842 3645 7119 13957 27875 57019 118784 248965 518377 1061933 2127937 4159415 7925179
26 55 101 176 309 552 985 1720 2904 4721 7393 11180 16379 23322 32373 43924 58390 76203 97805 123640 154145
9 12 13 14 36 147 502 1395 3326 7091 13918 25713 45571 78888 135761 236052 419855 768766 1448395 2791736 5459054
19 34 44 44 29 -6 -66 -156 -281 -446 -656 -916 -1231 -1606 -2046 -2556 -3141 -3806 -4556 -5396 -6331
9 14 21 30 41 54 69 86 105 126 149 174 201 230 261 294 329 366 405 446 489
14 29 56 107 213 436 882 1714 3169 5593 9529 15949 26878 47062 88264 179732 392224 890112 2038800 4616520 10215759
-8 -1 32 114 281 601 1223 2470 5004 10115 20215 39647 75943 141679 257074 453459 777696 1297551 2107914 3337608 5156333
19 29 54 119 254 502 951 1801 3477 6799 13220 25143 46328 82400 141469 234873 378055 591585 902338 1344839 1962786
5 4 3 22 105 343 913 2134 4539 8956 16578 28979 47997 75353 111804 155535 199377 226292 202389 66524 -284711
1 4 15 43 97 186 319 505 753 1072 1471 1959 2545 3238 4047 4981 6049 7260 8623 10147 11841
19 40 88 171 302 507 837 1390 2362 4176 7787 15332 31409 65498 136531 281635 572981 1149916 2278550 4457913 8600352
-4 -5 -10 -15 -13 9 77 251 682 1739 4252 9929 22017 46289 92451 176075 321176 563563 955106 1569073 2506703
11 24 42 63 85 106 124 137 143 140 126 99 57 -2 -80 -179 -301 -448 -622 -825 -1059
10 29 65 141 307 655 1336 2588 4789 8549 14850 25249 42228 70021 116879 201090 365668 711205 1463967 3108277 6630345
20 35 53 69 76 69 56 89 344 1306 4157 11531 28909 67113 146675 305384 611160 1183713 2230401 4104533 7398350
-1 -7 -12 -14 -1 57 221 606 1432 3162 6874 15169 34157 77398 173088 376175 787172 1578466 3025279 5528847 9597710
4 11 19 43 121 321 751 1572 3004 5315 8818 14021 22371 38650 77224 176275 427156 1030391 2395821 5312043 11219397
17 20 16 -2 -37 -76 -68 114 731 2268 5603 12379 25828 52457 105162 208404 405921 770848 1416766 2505680 4244677
25 44 86 164 286 463 742 1274 2425 4934 10122 20175 38584 70953 126621 221975 387207 680246 1216224 2231404 4223440
30 58 110 199 351 616 1079 1871 3180 5262 8452 13175 19957 29436 42373 59663 82346 111618 148842 195559 253499
24 34 48 68 94 137 237 496 1148 2692 6114 13244 27402 54840 108412 217037 449032 966338 2143496 4815536 10771438
-3 -8 -13 -18 -23 -28 -33 -38 -43 -48 -53 -58 -63 -68 -73 -78 -83 -88 -93 -98 -103
21 40 83 180 379 744 1358 2347 3949 6676 11669 21442 41386 82749 168542 345411 707857 1447860 2955575 6019392 12212385
-5 -8 -11 -14 -17 -20 -23 -26 -29 -32 -35 -38 -41 -44 -47 -50 -53 -56 -59 -62 -65
23 35 62 110 185 298 470 737 1155 1805 2798 4280 6437 9500 13750 19523 27215 37287 50270 66770 87473
11 33 84 184 364 684 1263 2321 4233 7595 13302 22638 37378 59902 93321 141615 209783 304005 431816 602292 826248
22 42 88 187 395 821 1662 3256 6165 11305 20145 35002 59464 98978 161645 259269 408712 633612 966526 1451565 2147593
19 38 71 130 242 452 821 1431 2434 4214 7766 15434 32207 67899 140848 284466 559397 1076714 2042265 3840014 7184432
12 25 47 84 141 220 318 425 522 579 553 386 3 -690 -1808 -3489 -5896 -9219 -13677 -19520 -27031
12 23 40 86 197 422 823 1475 2466 3897 5882 8548 12035 16496 22097 29017 37448 47595 59676 73922 90577
19 49 94 150 218 328 577 1181 2546 5372 10817 20765 38263 68217 118466 201386 336213 552315 893688 1425000 2239560
18 39 75 124 188 287 478 888 1786 3736 7890 16499 33746 67046 129025 240497 434922 765069 1312949 2204550 3631528
11 10 16 45 124 288 576 1027 1684 2643 4263 7832 17352 43821 114725 293860 720797 1686360 3771970 8098799 16760328
10 15 29 71 168 364 753 1561 3318 7185 15537 32965 67982 135964 264331 501829 935226 1719067 3127709 5644131 10107540
19 20 21 25 34 49 70 96 125 154 179 195 196 175 124 34 -105 -304 -575 -931 -1386
9 12 25 55 109 194 317 485 705 984 1329 1747 2245 2830 3509 4289 5177 6180 7305 8559 9949
20 28 34 48 87 175 343 629 1078 1742 2680 3958 5649 7833 10597 14035 18248 23344 29438 36652 45115
7 14 21 28 35 42 49 56 63 70 77 84 91 98 105 112 119 126 133 140 147
2 9 34 82 155 253 392 656 1302 2938 6805 15232 32417 65833 128769 244761 454842 828395 1477428 2571386 4343599
11 21 56 130 269 523 976 1751 3013 4992 8100 13349 23590 46765 103687 245277 588315 1385443 3155476 6915384 14577239
13 22 31 40 49 58 67 76 85 94 103 112 121 130 139 148 157 166 175 184 193
27 56 100 156 232 361 623 1188 2399 4919 9976 19769 38168 71982 133319 243967 443339 802410 1447300 2597802 4628304
8 16 31 54 98 210 504 1205 2704 5624 10897 19852 34314 56714 90210 138819 207560 302608 431459 603106 828226
-5 -7 -8 -8 -7 -5 -2 2 7 13 20 28 37 47 58 70 83 97 112 128 145
-8 -6 5 27 71 177 451 1127 2662 5872 12117 23543 43389 76367 129123 210787 333620 513766 772117 1135299 1636787
7 2 0 8 43 142 376 879 1927 4134 8867 19015 40273 83116 165635 317382 584319 1034882 1767050 2916146 4662887
6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66
-3 9 46 137 328 693 1367 2628 5068 9906 19509 38200 73445 137524 249804 439745 750783 1245247 2010480 3166347 4874326
11 5 6 32 108 264 533 949 1545 2351 3392 4686 6242 8058 10119 12395 14839 17385 19946 22412 24648
15 25 36 59 116 247 520 1058 2111 4215 8494 17175 34400 67433 128374 236506 421415 727037 1216800 1980043 3139908
19 41 83 150 251 413 710 1327 2699 5799 12704 27657 59001 122686 248786 494160 968204 1886862 3687014 7266797 14480644
5 9 23 57 126 254 486 917 1751 3414 6768 13528 27117 54488 110028 223727 457605 937283 1909993 3846783 7615836
1 13 38 77 131 201 288 393 517 661 826 1013 1223 1457 1716 2001 2313 2653 3022 3421 3851
16 24 51 106 210 406 779 1513 3032 6304 13443 28841 61218 127219 257586 507721 976288 1840042 3424195 6353730 11889274
3 16 46 96 170 284 484 866 1598 2951 5353 9495 16569 28879 51518 96965 197239 434540 1014814 2436316 5859350
15 36 78 156 289 500 816 1268 1891 2724 3810 5196 6933 9076 11684 14820 18551 22948 28086 34044 40905
5 15 40 91 189 367 670 1152 1877 2938 4516 7034 11589 21232 44657 106136 270398 701042 1790570 4437721 10619096
2 5 8 11 23 81 278 800 1972 4313 8600 15941 27857 46373 74118 114434 171494 250429 357464 500063 687083
17 36 69 123 205 322 481 689 953 1280 1677 2151 2709 3358 4105 4957 5921 7004 8213 9555 11037
11 20 27 43 103 289 775 1906 4341 9334 19308 39006 77691 153125 298396 573093 1080863 1996032 3602745 6350989 10934919
8 3 -10 -24 -8 117 516 1495 3580 7636 15056 28069 50240 87264 148190 247250 406512 659625 1056978 1672654 2613624
16 33 64 118 227 458 920 1758 3117 5043 7262 8739 6864 -3962 -34664 -105197 -250210 -527443 -1029844 -1902644 -3366919
5 16 31 49 81 174 445 1124 2603 5495 10727 19738 34972 61151 108483 200344 390605 800450 1692383 3611715 7645255
9 22 60 140 278 488 791 1245 2021 3576 7022 14889 32687 72090 157376 338266 714973 1485687 3033414 6078033 11929020
11 9 14 48 141 329 654 1162 1904 2981 4760 8558 18387 44821 112735 275634 640621 1409889 2947214 5881708 11266781
20 44 81 129 184 240 289 321 324 284 185 9 -264 -656 -1191 -1895 -2796 -3924 -5311 -6991 -9000
12 17 24 35 59 120 270 603 1278 2598 5266 11062 24387 55457 126494 283190 615208 1291791 2622012 5154237 9836507
7 24 62 139 293 591 1148 2170 4036 7435 13575 24482 43408 75368 127827 211559 341701 539026 831460 1255869 1860143
11 12 28 72 157 296 502 788 1167 1652 2256 2992 3873 4912 6122 7516 9107 10908 12932 15192 17701
6 16 23 33 73 205 550 1334 2981 6296 12796 25248 48455 90317 163278 286701 492071 836502 1438618 2570383 4880812
15 37 82 171 337 625 1092 1807 2851 4317 6310 8947 12357 16681 22072 28695 36727 46357 57786 71227 86905
19 31 57 117 249 527 1092 2207 4359 8443 16087 30243 56337 104653 195437 369876 713488 1405188 2818342 5724586 11695386
6 16 44 111 246 491 912 1616 2774 4650 7636 12293 19398 29997 45464 67566 98534 141140 198780 275563 376406
-3 -11 -21 -36 -62 -103 -152 -183 -154 -23 269 1030 3758 13932 48049 149608 422775 1099217 2664467 6087084 13219334
12 18 40 84 167 339 727 1623 3660 8155 17746 37511 76831 152346 292453 543908 981220 1719664 2932892 4876286 7917375
13 15 17 19 26 57 172 539 1570 4168 10156 23019 49202 100390 197443 376892 700908 1271018 2243896 3843428 6356047
11 14 19 32 76 199 493 1142 2519 5363 11112 22587 45475 91551 185520 379175 780071 1608568 3309353 6765322 13698938
10 3 1 13 57 164 375 725 1218 1823 2577 4001 8279 22119 63097 172962 444637 1076046 2476380 5474328 11722452
20 30 46 83 162 324 673 1473 3340 7602 16958 36655 76510 154204 300330 565689 1031483 1824069 3139777 5296498 8856709
11 21 26 26 21 11 -4 -24 -49 -79 -114 -154 -199 -249 -304 -364 -429 -499 -574 -654 -739
14 26 42 76 152 310 620 1204 2266 4130 7286 12444 20596 33086 51688 78692 116998 170218 242786 340076 468528
7 20 34 55 110 266 656 1512 3205 6292 11570 20137 33460 53450 82544 123794 180963 258628 362290 498491 674938
2 13 39 80 136 207 293 394 510 641 787 948 1124 1315 1521 1742 1978 2229 2495 2776 3072
5 5 3 -1 -7 -15 -25 -37 -51 -67 -85 -105 -127 -151 -177 -205 -235 -267 -301 -337 -375
11 22 41 82 175 375 772 1499 2748 4830 8357 14688 26877 51504 101981 204232 406085 792330 1508245 2795538 5046175
20 45 83 142 240 405 675 1098 1732 2645 3915 5630 7888 10797 14475 19050 24660 31453 39587 49230 60560
5 18 38 65 99 140 188 243 305 374 450 533 623 720 824 935 1053 1178 1310 1449 1595
9 9 7 11 54 205 578 1339 2727 5144 9442 17666 34748 72066 154497 333750 712533 1486659 3015673 5937053 11344434
11 16 17 23 71 249 729 1816 4037 8323 16370 31291 58671 108075 194868 341769 578687 937782 1437927 2048211 2612991
3 17 59 142 277 487 850 1583 3175 6582 13528 27036 52471 99648 186983 349291 651715 1213463 2246601 4117170 7438441
14 35 82 173 345 679 1348 2705 5434 10796 21028 40028 74638 137216 250957 460990 857520 1624007 3137096 6172221 12320889
18 40 82 156 274 448 690 1012 1426 1944 2578 3340 4242 5296 6514 7908 9490 11272 13266 15484 17938
2 10 20 32 46 62 80 100 122 146 172 200 230 262 296 332 370 410 452 496 542
6 11 17 24 32 41 51 62 74 87 101 116 132 149 167 186 206 227 249 272 296
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
18 26 47 107 254 577 1244 2573 5163 10135 19572 37314 70391 131642 244633 453148 839776 1562216 2922989 5499853 10382500
10 2 -10 -20 -20 -6 13 3 -110 -458 -1252 -2806 -5564 -10130 -17301 -28103 -43830 -66086 -96830 -138424 -193684
19 27 33 36 34 29 48 198 791 2596 7300 18308 42132 90902 187123 372912 727867 1402825 2681539 5089340 9577870
1 -2 -13 -31 -40 0 174 666 1879 4666 10729 23257 47904 94303 178592 328133 591157 1057146 1899391 3460813 6419832
-1 12 37 71 117 203 424 1016 2475 5758 12668 26658 54533 109981 220754 443156 891322 1796624 3628200 7335823 14832704
-1 12 37 88 190 382 726 1332 2433 4579 9071 18841 40135 85649 180388 372895 757551 1520190 3032625 6047566 12093208
5 5 -2 -12 -12 20 115 313 663 1223 2060 3250 4878 7038 9833 13375 17785 23193 29738 37568 46840
4 1 -7 -20 -38 -61 -89 -122 -160 -203 -251 -304 -362 -425 -493 -566 -644 -727 -815 -908 -1006
19 34 65 123 227 424 821 1628 3222 6269 11997 22828 43822 85910 172982 357075 750120 1588635 3362328 7063820 14662980
13 40 79 134 220 371 648 1153 2074 3828 7460 15637 34903 80405 185147 417080 909107 1909504 3863477 7540752 14229406
15 39 73 125 227 451 927 1863 3567 6471 11157 18385 29123 44579 66235 95883 135663 188103 256161 343269 453379
13 18 35 67 110 150 160 97 -101 -518 -1263 -2473 -4316 -6994 -10746 -15851 -22631 -31454 -42737 -56949 -74614
4 0 -4 -8 -12 -16 -20 -24 -28 -32 -36 -40 -44 -48 -52 -56 -60 -64 -68 -72 -76
14 36 63 91 116 134 141 133 106 56 -21 -129 -272 -454 -679 -951 -1274 -1652 -2089 -2589 -3156
23 28 43 89 188 372 710 1357 2629 5108 9781 18217 32786 56924 95448 154925 244099 374380 560399 820633 1178104
26 50 83 125 190 318 599 1218 2529 5166 10200 19353 35283 61958 105142 173022 277012 432778 661537 991693 1460884
4 10 31 86 215 508 1144 2435 4870 9154 16237 27328 43889 67604 100318 143941 200312 271018 357163 459082 575995
-3 2 17 54 147 369 868 1945 4215 8916 18453 37271 73125 138733 253632 445774 751961 1215582 1879233 2768620 3862607
20 23 26 36 70 171 440 1097 2593 5821 12533 26179 53571 108095 215757 426377 834186 1615819 3100908 5904194 11173524
10 20 42 76 122 180 250 332 426 532 650 780 922 1076 1242 1420 1610 1812 2026 2252 2490
12 20 28 36 44 52 60 68 76 84 92 100 108 116 124 132 140 148 156 164 172
6 23 45 69 107 196 416 934 2099 4622 9886 20444 40778 78409 145467 260851 453132 764377 1255099 2010567 3148741
26 36 53 91 163 289 511 909 1622 2900 5258 9893 19693 41457 90412 198823 431522 912620 1869611 3703639 7097999
14 15 19 39 98 241 569 1304 2899 6234 13006 26559 53672 108364 219866 449102 922329 1898779 3904168 7988507 16212107
19 28 36 39 30 -1 -67 -184 -371 -650 -1046 -1587 -2304 -3231 -4405 -5866 -7657 -9824 -12416 -15485 -19086
10 23 36 49 62 75 88 101 114 127 140 153 166 179 192 205 218 231 244 257 270
12 21 35 61 126 285 637 1370 2868 5929 12171 24755 49646 97785 188781 357080 662060 1204173 2150147 3771417 6501422
9 6 2 -3 -9 -16 -24 -33 -43 -54 -66 -79 -93 -108 -124 -141 -159 -178 -198 -219 -241
7 8 22 69 176 386 788 1577 3152 6261 12211 23206 43021 78589 143912 269497 524285 1064876 2242897 4833512 10510884
12 25 38 51 64 77 90 103 116 129 142 155 168 181 194 207 220 233 246 259 272
8 22 41 78 164 356 751 1511 2908 5413 9899 18142 34057 66633 136587 290821 632724 1383808 3005877 6437550 13542006
0 -3 -2 24 119 354 837 1752 3476 6871 13933 29137 62113 132839 281539 587258 1202215 2414497 4761306 9232575 17638400
17 42 92 188 376 751 1488 2892 5504 10333 19328 36267 68344 128934 242423 452813 839399 1545708 2832888 5176966 9442396
17 21 38 82 169 317 546 878 1337 1949 2742 3746 4993 6517 8354 10542 13121 16133 19622 23634 28217
21 29 37 45 53 61 69 77 85 93 101 109 117 125 133 141 149 157 165 173 181
7 8 13 26 57 122 243 448 771 1252 1937 2878 4133 5766 7847 10452 13663 17568 22261 27842 34417
-5 -5 2 19 42 55 20 -144 -597 -1621 -3634 -7089 -12094 -17477 -18868 -5172 47443 185227 491754 1110051 2274466
23 44 72 106 161 283 572 1232 2681 5771 12194 25194 50779 99746 191014 357026 652355 1167158 2047796 3527810 5973549
9 30 73 159 318 589 1020 1668 2599 3888 5619 7885 10788 14439 18958 24474 31125 39058 48429 59403 72154
14 11 18 49 122 275 601 1312 2848 6066 12592 25513 50747 99691 194178 375523 720847 1372745 2594617 4877979 9159341
-7 -6 10 51 127 250 451 833 1702 3859 9215 22033 51334 115355 249438 519373 1043015 2023928 3801840 6925759 12256609
8 16 35 75 165 367 801 1701 3535 7235 14596 28916 55962 105360 192520 341220 586986 981418 1597625 2536945 3937139
8 9 22 53 110 213 423 913 2130 5147 12394 29110 66104 144789 306003 624906 1235300 2368125 4410710 7995683 14131354
12 24 51 109 222 429 805 1504 2832 5358 10071 18591 33442 58395 98889 162538 259732 404340 614523 913665 1331430
2 -6 -7 20 111 320 734 1509 2946 5661 10970 21713 43891 89725 183161 369632 733386 1428444 2734087 5153866 9590111
15 25 52 115 256 559 1173 2333 4373 7726 12917 20602 31835 49021 78509 136544 261287 534563 1117214 2299965 4564870
7 27 76 181 394 805 1556 2856 4997 8371 13488 20995 31696 46573 66808 93806 129219 174971 233284 306705 398134
8 17 43 101 206 373 617 953 1396 1961 2663 3517 4538 5741 7141 8753 10592 12673 15011 17621 20518

View File

@ -0,0 +1,3 @@
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45

View File

@ -0,0 +1,3 @@
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45

View File

@ -16,7 +16,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
Box::new(day06::Day06 {}), Box::new(day06::Day06 {}),
Box::new(day07::Day07 {}), Box::new(day07::Day07 {}),
Box::new(day08::Day08 {}), Box::new(day08::Day08 {}),
// Box::new(day09::Day09 {}), Box::new(day09::Day09 {}),
// Box::new(day10::Day10 {}), // Box::new(day10::Day10 {}),
// Box::new(day11::Day11 {}), // Box::new(day11::Day11 {}),
// Box::new(day12::Day12 {}), // Box::new(day12::Day12 {}),

View File

@ -5,16 +5,18 @@ pub struct Day09 {}
impl Solution for Day09 { impl Solution for Day09 {
fn part1( fn part1(
&self, &self,
_input: &mut Vec<String>, input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> { ) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready")) let series_collection = self.get_series(input)?;
Ok(Box::new(self.sum_extrapolated(&series_collection, true)?))
} }
fn part2( fn part2(
&self, &self,
_input: &mut Vec<String>, input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> { ) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready")) let series_collection = self.get_series(input)?;
Ok(Box::new(self.sum_extrapolated(&series_collection, false)?))
} }
fn get_day(&self) -> u8 { fn get_day(&self) -> u8 {
@ -22,7 +24,77 @@ impl Solution for Day09 {
} }
} }
impl Day09 {} impl Day09 {
/// Takes a vec of strings and returns a Vec of series of numbers
fn get_series(&self, input: &Vec<String>) -> Result<Vec<Vec<i32>>, Box<dyn std::error::Error>> {
let mut series = vec![];
for s in input.iter() {
series.push(
s.split_whitespace()
.map(|n| n.parse::<i32>().unwrap())
.collect(),
);
}
Ok(series)
}
/// Returns the sum ov extrapolated values either to the left or the right of the initial series
fn sum_extrapolated(
&self,
series_collection: &Vec<Vec<i32>>,
forwards: bool,
) -> Result<i32, Box<dyn std::error::Error>> {
let mut ans = 0i32;
for series in series_collection {
let mut differences = vec![series.clone()];
// Keep finding differences until we have a consistent difference of 0
while differences
.last()
.unwrap()
.iter()
.map(|v| v.abs())
.sum::<i32>()
!= 0i32
{
differences.push(
differences
.last()
.unwrap()
.windows(2)
.map(|w| w[1] - w[0])
.collect::<Vec<i32>>(),
);
}
if forwards {
// Sum all of the last values in each row to get next num
ans += differences
.iter()
.map(|s| *s.last().unwrap())
.collect::<Vec<i32>>()
.iter()
.sum::<i32>();
} else {
// Scale backwards down the heap to find the previous number in each sequence
let mut next = 0i32;
differences
.iter()
.rev()
.map(|s| *s.first().unwrap())
.collect::<Vec<i32>>()
.iter()
.for_each(|v| {
next = v - next;
});
ans += next;
}
}
Ok(ans)
}
}
/// Test from puzzle input /// Test from puzzle input
#[cfg(test)] #[cfg(test)]
@ -44,7 +116,7 @@ mod test {
.unwrap() .unwrap()
.to_string(); .to_string();
assert_eq!(answer, "Ready"); assert_eq!(answer, "114");
} }
#[test] #[test]
@ -61,6 +133,6 @@ mod test {
.unwrap() .unwrap()
.to_string(); .to_string();
assert_eq!(answer, "Ready"); assert_eq!(answer, "2");
} }
} }