Add files via upload

This commit is contained in:
Peter Norvig 2024-12-12 15:44:31 -08:00 committed by GitHub
parent 832974caca
commit 9de830b2d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,10 +18,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 3,
"id": "ed82ed5b-a42d-468b-8f6e-288d3c2de20b", "id": "ed82ed5b-a42d-468b-8f6e-288d3c2de20b",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Matplotlib is building the font cache; this may take a moment.\n"
]
}
],
"source": [ "source": [
"%run AdventUtils.ipynb\n", "%run AdventUtils.ipynb\n",
"current_year = 2024" "current_year = 2024"
@ -58,7 +66,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 6,
"id": "22e5d621-a152-4712-866f-f8b962b5dd14", "id": "22e5d621-a152-4712-866f-f8b962b5dd14",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -111,7 +119,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 8,
"id": "2dbfa3ae-3d47-4711-8821-7d1b2564bdc8", "id": "2dbfa3ae-3d47-4711-8821-7d1b2564bdc8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -121,7 +129,7 @@
"Puzzle 1.1: .0002 seconds, answer 1830467 ok" "Puzzle 1.1: .0002 seconds, answer 1830467 ok"
] ]
}, },
"execution_count": 3, "execution_count": 8,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -147,17 +155,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 10,
"id": "e33f9705-3b51-4314-a302-6b3445290713", "id": "e33f9705-3b51-4314-a302-6b3445290713",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 1.2: .0002 seconds, answer 26674158 ok" "Puzzle 1.2: .0001 seconds, answer 26674158 ok"
] ]
}, },
"execution_count": 4, "execution_count": 10,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -184,7 +192,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 12,
"id": "10e1ab83-a6ec-4143-ad9a-eaae220adcde", "id": "10e1ab83-a6ec-4143-ad9a-eaae220adcde",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -235,7 +243,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 14,
"id": "368cbe1c-b6b6-4a82-bef9-599ee9725899", "id": "368cbe1c-b6b6-4a82-bef9-599ee9725899",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -255,17 +263,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 15,
"id": "e662bf10-4d6a-40f1-95ce-dfc39f5b3fc2", "id": "e662bf10-4d6a-40f1-95ce-dfc39f5b3fc2",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 2.1: .0011 seconds, answer 257 ok" "Puzzle 2.1: .0004 seconds, answer 257 ok"
] ]
}, },
"execution_count": 7, "execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -287,7 +295,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 17,
"id": "67ba1d53-95b7-4811-b225-2ff15d6bdc5c", "id": "67ba1d53-95b7-4811-b225-2ff15d6bdc5c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -305,17 +313,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 18,
"id": "d1b9ffb5-af7a-465f-a063-c31df2d0605c", "id": "d1b9ffb5-af7a-465f-a063-c31df2d0605c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 2.2: .0072 seconds, answer 328 ok" "Puzzle 2.2: .0022 seconds, answer 328 ok"
] ]
}, },
"execution_count": 9, "execution_count": 18,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -337,7 +345,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 20,
"id": "78080200-0f9f-4492-9bee-c936737ee96f", "id": "78080200-0f9f-4492-9bee-c936737ee96f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -376,7 +384,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 22,
"id": "bf6366b1-6952-47d8-8b3c-09f8d05ec093", "id": "bf6366b1-6952-47d8-8b3c-09f8d05ec093",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -396,17 +404,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 23,
"id": "2032c903-5f23-4c16-ba68-410b6c1750e1", "id": "2032c903-5f23-4c16-ba68-410b6c1750e1",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 3.1: .0014 seconds, answer 156388521 ok" "Puzzle 3.1: .0006 seconds, answer 156388521 ok"
] ]
}, },
"execution_count": 12, "execution_count": 23,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -428,7 +436,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 25,
"id": "4525d01a-bac0-41c2-92b8-baf0fd395e88", "id": "4525d01a-bac0-41c2-92b8-baf0fd395e88",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -445,17 +453,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 26,
"id": "ce40f258-ca76-48c3-9965-27a6979a4243", "id": "ce40f258-ca76-48c3-9965-27a6979a4243",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 3.2: .0009 seconds, answer 75920122 ok" "Puzzle 3.2: .0004 seconds, answer 75920122 ok"
] ]
}, },
"execution_count": 14, "execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -477,7 +485,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 28,
"id": "a0d903b9-018e-4861-9314-cafed59055fd", "id": "a0d903b9-018e-4861-9314-cafed59055fd",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -516,7 +524,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 30,
"id": "72d48abb-7a82-452f-b91d-838b3836a90f", "id": "72d48abb-7a82-452f-b91d-838b3836a90f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -535,17 +543,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 31,
"id": "6175362b-d8b4-45d1-b70c-d8575a0fe188", "id": "6175362b-d8b4-45d1-b70c-d8575a0fe188",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 4.1: .0706 seconds, answer 2401 ok" "Puzzle 4.1: .0338 seconds, answer 2401 ok"
] ]
}, },
"execution_count": 17, "execution_count": 31,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -573,17 +581,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 33,
"id": "ff7540fd-b5cb-4d02-810d-5c77da2bd9f4", "id": "ff7540fd-b5cb-4d02-810d-5c77da2bd9f4",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 4.2: .0597 seconds, answer 1822 ok" "Puzzle 4.2: .0259 seconds, answer 1822 ok"
] ]
}, },
"execution_count": 18, "execution_count": 33,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -618,7 +626,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 35,
"id": "b77a5a1f-a43b-4ce8-a60c-94d69a595505", "id": "b77a5a1f-a43b-4ce8-a60c-94d69a595505",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -686,7 +694,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 37,
"id": "78898d37-46ff-4367-9d89-b2a107a90aa1", "id": "78898d37-46ff-4367-9d89-b2a107a90aa1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -704,17 +712,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 38,
"id": "b1c87359-1d2d-4a90-8305-9d152ce5d547", "id": "b1c87359-1d2d-4a90-8305-9d152ce5d547",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 5.1: .0010 seconds, answer 5762 ok" "Puzzle 5.1: .0006 seconds, answer 5762 ok"
] ]
}, },
"execution_count": 21, "execution_count": 38,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -737,7 +745,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 40,
"id": "d8718c3e-0b3b-49ce-8cca-abd82aa788d7", "id": "d8718c3e-0b3b-49ce-8cca-abd82aa788d7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -747,7 +755,7 @@
"23" "23"
] ]
}, },
"execution_count": 22, "execution_count": 40,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -770,7 +778,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 42,
"id": "7222dc1c-067f-4bb5-84e1-3c2fc72fd53a", "id": "7222dc1c-067f-4bb5-84e1-3c2fc72fd53a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -789,17 +797,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 43,
"id": "dc1fbda9-2cfd-442a-afef-12c9b0d2b17f", "id": "dc1fbda9-2cfd-442a-afef-12c9b0d2b17f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 5.2: .0015 seconds, answer 4130 ok" "Puzzle 5.2: .0008 seconds, answer 4130 ok"
] ]
}, },
"execution_count": 24, "execution_count": 43,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -829,7 +837,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 46,
"id": "6ec71cf8-c43d-457e-8e14-0e9eb99b956a", "id": "6ec71cf8-c43d-457e-8e14-0e9eb99b956a",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -871,17 +879,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 48,
"id": "aecb67fd-2c8a-40a8-9e67-e495b7cb8043", "id": "aecb67fd-2c8a-40a8-9e67-e495b7cb8043",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 6.1: .0040 seconds, answer 5329 ok" "Puzzle 6.1: .0014 seconds, answer 5329 ok"
] ]
}, },
"execution_count": 26, "execution_count": 48,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -922,7 +930,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 50,
"id": "1718fecb-aa3e-4162-9948-1c06d4ec5e8a", "id": "1718fecb-aa3e-4162-9948-1c06d4ec5e8a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -954,17 +962,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 51,
"id": "36196264-eb33-4fc0-95d5-06c985105ebf", "id": "36196264-eb33-4fc0-95d5-06c985105ebf",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 6.2: 5.2261 seconds, answer 2162 ok" "Puzzle 6.2: 1.9151 seconds, answer 2162 ok"
] ]
}, },
"execution_count": 28, "execution_count": 51,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -994,7 +1002,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 54,
"id": "c1c6cee8-122c-43c9-8c7d-ed8980ea2b76", "id": "c1c6cee8-122c-43c9-8c7d-ed8980ea2b76",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1055,7 +1063,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 57,
"id": "6fa3907c-0e1a-4d4a-9fc3-f809b9325674", "id": "6fa3907c-0e1a-4d4a-9fc3-f809b9325674",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1065,7 +1073,7 @@
"13" "13"
] ]
}, },
"execution_count": 30, "execution_count": 57,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1084,7 +1092,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 59,
"id": "5dfe0edf-cf29-4623-bb2c-6180f832f4d7", "id": "5dfe0edf-cf29-4623-bb2c-6180f832f4d7",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1100,17 +1108,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 60,
"id": "3085596d-f5ec-4ba8-b05a-cf70cf276a0c", "id": "3085596d-f5ec-4ba8-b05a-cf70cf276a0c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 7.1: .0415 seconds, answer 1985268524462 ok" "Puzzle 7.1: .0217 seconds, answer 1985268524462 ok"
] ]
}, },
"execution_count": 32, "execution_count": 60,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1132,17 +1140,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 62,
"id": "5bdcb999-7f38-4814-bca5-13db88f4e214", "id": "5bdcb999-7f38-4814-bca5-13db88f4e214",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 7.2: 2.7765 seconds, answer 150077710195188 ok" "Puzzle 7.2: 1.1006 seconds, answer 150077710195188 ok"
] ]
}, },
"execution_count": 33, "execution_count": 62,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1166,7 +1174,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 64,
"id": "cf6361a7-e3bc-42ec-ae16-f9eec166055e", "id": "cf6361a7-e3bc-42ec-ae16-f9eec166055e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1207,7 +1215,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 66,
"id": "22180ce8-5d03-4aee-8c73-62f2afbddf71", "id": "22180ce8-5d03-4aee-8c73-62f2afbddf71",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1228,17 +1236,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 67,
"id": "dd173ce9-cbbb-4282-b43f-c7cff662bd90", "id": "dd173ce9-cbbb-4282-b43f-c7cff662bd90",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 8.1: .0070 seconds, answer 220 ok" "Puzzle 8.1: .0026 seconds, answer 220 ok"
] ]
}, },
"execution_count": 36, "execution_count": 67,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1262,7 +1270,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 69,
"id": "d30f8ce9-f186-46a0-a2e7-f74eceae6905", "id": "d30f8ce9-f186-46a0-a2e7-f74eceae6905",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1283,17 +1291,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 70,
"id": "6bf85b57-8b8f-4196-9903-6d5fe082f404", "id": "6bf85b57-8b8f-4196-9903-6d5fe082f404",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 8.1: .0063 seconds, answer 220 ok" "Puzzle 8.1: .0025 seconds, answer 220 ok"
] ]
}, },
"execution_count": 38, "execution_count": 70,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1305,17 +1313,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 71,
"id": "f232952c-5fc6-4696-a8b1-d0b54137ac02", "id": "f232952c-5fc6-4696-a8b1-d0b54137ac02",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 8.2: .0075 seconds, answer 813 ok" "Puzzle 8.2: .0030 seconds, answer 813 ok"
] ]
}, },
"execution_count": 39, "execution_count": 71,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1345,7 +1353,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 74,
"id": "0e944f9e-5c16-440c-b12e-178058a87048", "id": "0e944f9e-5c16-440c-b12e-178058a87048",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1386,7 +1394,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": 76,
"id": "76e8454d-a2f3-4b6b-92df-182116cf46e0", "id": "76e8454d-a2f3-4b6b-92df-182116cf46e0",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1421,17 +1429,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 77,
"id": "2aa7e2b9-844e-49ed-b41b-4a4cecff86b7", "id": "2aa7e2b9-844e-49ed-b41b-4a4cecff86b7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 9.1: .0438 seconds, answer 6332189866718 ok" "Puzzle 9.1: .0193 seconds, answer 6332189866718 ok"
] ]
}, },
"execution_count": 42, "execution_count": 77,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1459,7 +1467,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 43, "execution_count": 79,
"id": "fcf4d832-3d7d-4987-aa57-e6e0f1df16bf", "id": "fcf4d832-3d7d-4987-aa57-e6e0f1df16bf",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1502,17 +1510,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 44, "execution_count": 80,
"id": "e3036875-88d0-496e-9d2f-facd0e80a5b2", "id": "e3036875-88d0-496e-9d2f-facd0e80a5b2",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 9.2: 6.2652 seconds, answer 6353648390778 ok" "Puzzle 9.2: 2.6956 seconds, answer 6353648390778 ok"
] ]
}, },
"execution_count": 44, "execution_count": 80,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1542,7 +1550,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 45, "execution_count": 83,
"id": "5804fb03-05f3-402f-b6cc-6804c5d22512", "id": "5804fb03-05f3-402f-b6cc-6804c5d22512",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1595,7 +1603,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 46, "execution_count": 85,
"id": "76b5379e-ee19-4607-91b8-88ec7b38023f", "id": "76b5379e-ee19-4607-91b8-88ec7b38023f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1611,17 +1619,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 47, "execution_count": 86,
"id": "97cf05f7-fa56-4a90-b2d8-2cd4d9b81f95", "id": "97cf05f7-fa56-4a90-b2d8-2cd4d9b81f95",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 10.1: .0182 seconds, answer 744 ok" "Puzzle 10.1: .0046 seconds, answer 744 ok"
] ]
}, },
"execution_count": 47, "execution_count": 86,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1645,7 +1653,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 48, "execution_count": 88,
"id": "b763450f-a565-4936-bee4-e531c2eeebdb", "id": "b763450f-a565-4936-bee4-e531c2eeebdb",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1662,17 +1670,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 49, "execution_count": 89,
"id": "f8a87032-6556-4fc9-9bb8-573611aee8dc", "id": "f8a87032-6556-4fc9-9bb8-573611aee8dc",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 10.2: .0218 seconds, answer 1651 ok" "Puzzle 10.2: .0057 seconds, answer 1651 ok"
] ]
}, },
"execution_count": 49, "execution_count": 89,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1702,7 +1710,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 50, "execution_count": 92,
"id": "76b68cef-d8de-4145-b65c-b254fedf1671", "id": "76b68cef-d8de-4145-b65c-b254fedf1671",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1746,7 +1754,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 51, "execution_count": 94,
"id": "1513df56-3d6f-42cf-8aec-1bdbeb991d90", "id": "1513df56-3d6f-42cf-8aec-1bdbeb991d90",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1772,17 +1780,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 52, "execution_count": 95,
"id": "eff17cd0-a2c7-4d69-bc55-c0ef97917915", "id": "eff17cd0-a2c7-4d69-bc55-c0ef97917915",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 11.1: .1609 seconds, answer 194482 ok" "Puzzle 11.1: .0626 seconds, answer 194482 ok"
] ]
}, },
"execution_count": 52, "execution_count": 95,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1802,13 +1810,13 @@
"It looks like the number of stones is roughly doubling every 1 or 2 blinks, so for 75 blinks we could have trillions of stones. I'd like something more efficient. I note that:\n", "It looks like the number of stones is roughly doubling every 1 or 2 blinks, so for 75 blinks we could have trillions of stones. I'd like something more efficient. I note that:\n",
"- Although the puzzle makes it clear that the stones are in a line, it turns out their position in the line is irrelevant.\n", "- Although the puzzle makes it clear that the stones are in a line, it turns out their position in the line is irrelevant.\n",
"- Because all the even-digit numbers get split in half, it seems like many small numbers will appear multiple times.\n", "- Because all the even-digit numbers get split in half, it seems like many small numbers will appear multiple times.\n",
"- (In the example, after 6 blinks the number 2 appears 4 times.)\n", "- (In the given example, after 6 blinks the number 2 appears 4 times.)\n",
"- Therefore, I'll keep a `Counter` of stones rather than a list of stones." "- Therefore, I'll keep a `Counter` of stones rather than a `list` of stones."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 53, "execution_count": 97,
"id": "707b5a97-0296-48df-bdab-e34064cc67c2", "id": "707b5a97-0296-48df-bdab-e34064cc67c2",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1833,17 +1841,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 54, "execution_count": 99,
"id": "efdcdbf8-e8ec-4a85-9d09-90a20e08c66a", "id": "efdcdbf8-e8ec-4a85-9d09-90a20e08c66a",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 11.1: .0034 seconds, answer 194482 ok" "Puzzle 11.1: .0015 seconds, answer 194482 ok"
] ]
}, },
"execution_count": 54, "execution_count": 99,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1855,17 +1863,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 55, "execution_count": 100,
"id": "657b1f13-ffcc-44c6-84f1-398fa2fcdac7", "id": "657b1f13-ffcc-44c6-84f1-398fa2fcdac7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 11.2: .1312 seconds, answer 232454623677743 ok" "Puzzle 11.2: .0548 seconds, answer 232454623677743 ok"
] ]
}, },
"execution_count": 55, "execution_count": 100,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1895,7 +1903,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 103,
"id": "8161ee7e-76e3-499a-abf8-a607991c9602", "id": "8161ee7e-76e3-499a-abf8-a607991c9602",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -1934,7 +1942,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57, "execution_count": 105,
"id": "79f91f38-e325-44f2-9e53-b64ce12d9d35", "id": "79f91f38-e325-44f2-9e53-b64ce12d9d35",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1963,7 +1971,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58, "execution_count": 107,
"id": "1fbabbfb-50c8-4197-8517-e7cee9582765", "id": "1fbabbfb-50c8-4197-8517-e7cee9582765",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -1987,17 +1995,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59, "execution_count": 108,
"id": "cdaf655b-d12c-4973-b19b-3132e5e691c6", "id": "cdaf655b-d12c-4973-b19b-3132e5e691c6",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 12.1: .0803 seconds, answer 1402544 ok" "Puzzle 12.1: .0307 seconds, answer 1402544 ok"
] ]
}, },
"execution_count": 59, "execution_count": 108,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -2037,7 +2045,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 110,
"id": "38c30e15-3a33-40c2-b734-163a15af7a8a", "id": "38c30e15-3a33-40c2-b734-163a15af7a8a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -2060,17 +2068,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 111,
"id": "72175812-dcd0-4f1b-9efa-0dceeeafa609", "id": "72175812-dcd0-4f1b-9efa-0dceeeafa609",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 12.1: .0783 seconds, answer 1402544 ok" "Puzzle 12.1: .0302 seconds, answer 1402544 ok"
] ]
}, },
"execution_count": 61, "execution_count": 111,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -2082,17 +2090,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 112,
"id": "9defcd35-91bc-41d4-a16f-bb7a4ede75e7", "id": "9defcd35-91bc-41d4-a16f-bb7a4ede75e7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"Puzzle 12.2: .1110 seconds, answer 862486 ok" "Puzzle 12.2: .0426 seconds, answer 862486 ok"
] ]
}, },
"execution_count": 62, "execution_count": 112,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -2109,12 +2117,12 @@
"source": [ "source": [
"# Summary\n", "# Summary\n",
"\n", "\n",
"So far, I've solved all the puzzles. Most of them run in well under a second, but three of them take multiple seconds." "So far, I've solved all the puzzles. Most of them run in well under a second, but three of them take over a second."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 114,
"id": "34813fc9-a000-4cd8-88ae-692851b3242c", "id": "34813fc9-a000-4cd8-88ae-692851b3242c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -2123,29 +2131,29 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Puzzle 1.1: .0002 seconds, answer 1830467 ok\n", "Puzzle 1.1: .0002 seconds, answer 1830467 ok\n",
"Puzzle 1.2: .0002 seconds, answer 26674158 ok\n", "Puzzle 1.2: .0001 seconds, answer 26674158 ok\n",
"Puzzle 2.1: .0011 seconds, answer 257 ok\n", "Puzzle 2.1: .0004 seconds, answer 257 ok\n",
"Puzzle 2.2: .0072 seconds, answer 328 ok\n", "Puzzle 2.2: .0022 seconds, answer 328 ok\n",
"Puzzle 3.1: .0014 seconds, answer 156388521 ok\n", "Puzzle 3.1: .0006 seconds, answer 156388521 ok\n",
"Puzzle 3.2: .0009 seconds, answer 75920122 ok\n", "Puzzle 3.2: .0004 seconds, answer 75920122 ok\n",
"Puzzle 4.1: .0706 seconds, answer 2401 ok\n", "Puzzle 4.1: .0338 seconds, answer 2401 ok\n",
"Puzzle 4.2: .0597 seconds, answer 1822 ok\n", "Puzzle 4.2: .0259 seconds, answer 1822 ok\n",
"Puzzle 5.1: .0010 seconds, answer 5762 ok\n", "Puzzle 5.1: .0006 seconds, answer 5762 ok\n",
"Puzzle 5.2: .0015 seconds, answer 4130 ok\n", "Puzzle 5.2: .0008 seconds, answer 4130 ok\n",
"Puzzle 6.1: .0040 seconds, answer 5329 ok\n", "Puzzle 6.1: .0014 seconds, answer 5329 ok\n",
"Puzzle 6.2: 5.2261 seconds, answer 2162 ok\n", "Puzzle 6.2: 1.9151 seconds, answer 2162 ok\n",
"Puzzle 7.1: .0415 seconds, answer 1985268524462 ok\n", "Puzzle 7.1: .0217 seconds, answer 1985268524462 ok\n",
"Puzzle 7.2: 2.7765 seconds, answer 150077710195188 ok\n", "Puzzle 7.2: 1.1006 seconds, answer 150077710195188 ok\n",
"Puzzle 8.1: .0063 seconds, answer 220 ok\n", "Puzzle 8.1: .0025 seconds, answer 220 ok\n",
"Puzzle 8.2: .0075 seconds, answer 813 ok\n", "Puzzle 8.2: .0030 seconds, answer 813 ok\n",
"Puzzle 9.1: .0438 seconds, answer 6332189866718 ok\n", "Puzzle 9.1: .0193 seconds, answer 6332189866718 ok\n",
"Puzzle 9.2: 6.2652 seconds, answer 6353648390778 ok\n", "Puzzle 9.2: 2.6956 seconds, answer 6353648390778 ok\n",
"Puzzle 10.1: .0182 seconds, answer 744 ok\n", "Puzzle 10.1: .0046 seconds, answer 744 ok\n",
"Puzzle 10.2: .0218 seconds, answer 1651 ok\n", "Puzzle 10.2: .0057 seconds, answer 1651 ok\n",
"Puzzle 11.1: .0034 seconds, answer 194482 ok\n", "Puzzle 11.1: .0015 seconds, answer 194482 ok\n",
"Puzzle 11.2: .1312 seconds, answer 232454623677743 ok\n", "Puzzle 11.2: .0548 seconds, answer 232454623677743 ok\n",
"Puzzle 12.1: .0783 seconds, answer 1402544 ok\n", "Puzzle 12.1: .0302 seconds, answer 1402544 ok\n",
"Puzzle 12.2: .1110 seconds, answer 862486 ok\n" "Puzzle 12.2: .0426 seconds, answer 862486 ok\n"
] ]
} }
], ],
@ -2171,7 +2179,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.15" "version": "3.12.7"
} }
}, },
"nbformat": 4, "nbformat": 4,