Add files via upload

This commit is contained in:
Peter Norvig 2023-01-24 15:18:29 -08:00 committed by GitHub
parent f6e8125a27
commit a1ab7bbb25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -584,8 +584,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 2.44 s, sys: 21.3 ms, total: 2.46 s\n",
"Wall time: 2.46 s\n"
"CPU times: user 2.52 s, sys: 22.1 ms, total: 2.55 s\n",
"Wall time: 2.58 s\n"
]
},
{
@ -849,8 +849,9 @@
"metadata": {},
"outputs": [],
"source": [
"def bounds(N): \n",
" return f'N = {N:2}: ' + ', '.join(f'{L}-{U}' for L, U in zip(lower_bounds(N), upper_bounds(N)))"
"def show_bounds(Ns): \n",
" for N in Ns: \n",
" print(f'N = {N:2}: ' + ' | '.join(f'{L}-{U:<2}' for L, U in zip(lower_bounds(N), upper_bounds(N))))"
]
},
{
@ -862,16 +863,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"N = 6: 1-1, 2-7, 2-7, 3-7, 3-7, 4-8\n",
"N = 10: 1-1, 2-14, 2-14, 3-14, 3-14, 3-14, 4-14, 4-14, 4-14, 5-15\n",
"N = 12: 1-1, 2-17, 2-17, 3-17, 3-17, 3-17, 4-17, 4-17, 4-17, 4-17, 5-17, 6-18\n",
"N = 20: 1-1, 2-32, 2-32, 3-32, 3-32, 3-32, 4-32, 4-32, 4-32, 4-32, 5-32, 5-32, 5-32, 5-32, 5-32, 6-32, 6-32, 6-32, 6-32, 7-33\n"
"N = 6: 1-1 | 2-7 | 2-7 | 3-7 | 3-7 | 4-8 \n",
"N = 8: 1-1 | 2-10 | 2-10 | 3-10 | 3-10 | 3-10 | 4-10 | 5-11\n",
"N = 10: 1-1 | 2-14 | 2-14 | 3-14 | 3-14 | 3-14 | 4-14 | 4-14 | 4-14 | 5-15\n",
"N = 12: 1-1 | 2-17 | 2-17 | 3-17 | 3-17 | 3-17 | 4-17 | 4-17 | 4-17 | 4-17 | 5-17 | 6-18\n",
"N = 13: 1-1 | 2-19 | 2-19 | 3-19 | 3-19 | 3-19 | 4-19 | 4-19 | 4-19 | 4-19 | 5-19 | 5-19 | 6-20\n"
]
}
],
"source": [
"for N in (6, 10, 12, 20):\n",
" print(bounds(N))"
"show_bounds((6, 8, 10, 12, 13))"
]
},
{
@ -1005,8 +1006,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 66.2 ms, sys: 1.27 ms, total: 67.4 ms\n",
"Wall time: 66.4 ms\n"
"CPU times: user 74.7 ms, sys: 1.29 ms, total: 76 ms\n",
"Wall time: 75.2 ms\n"
]
},
{
@ -1062,8 +1063,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 4.23 s, sys: 23 ms, total: 4.25 s\n",
"Wall time: 4.26 s\n"
"CPU times: user 4.76 s, sys: 49.9 ms, total: 4.81 s\n",
"Wall time: 4.86 s\n"
]
},
{
@ -1131,13 +1132,25 @@
"\n",
"Ali: Does it have to be one 2 on each die?\n",
"\n",
"**No. It could be one each, or it could be two on one die and none on the other. So a die with *t* twos can only pair with dice that have 2 - *t* twos.**\n",
"**Bo: No. It could be one each, or it could be two on one die and none on the other. So a die with *x* twos can only pair with dice that have 2 - *x* twos.**\n",
"\n",
"Ali: Great. Can you think of another property?\n",
"Ali: How about the number of 3s in a pair?\n",
"\n",
"**Bo: No. You got anything?**\n",
"**Bo: Hmm. A sum has to have three 4s, and the 4s have to come from either 2 + 2 or 3 + 1. So it is not as straightforward as with 2s. Let's make a table of allowable combinations for two dice, A and B:**\n",
"\n",
"Ali: Let's look at the sums of 6-sided Sicherman and standard pairs:"
"|A<br>1s|A<br>2s|A<br>3s|B<br>1s|B<br>2s|B<br>3s|ways to <br>sum to 4|\n",
"|-------|-------|-------|-------|-------|-------|-----|\n",
"|1|0 or 2|0|1|2 or 0|3|1+3, 1+3, 1+3|\n",
"|1|0 or 2|1|1|2 or 0|2|3+1, 1+3, 1+3|\n",
"|1|0 or 2|2|1|2 or 0|1|3+1, 3+1, 1+3|\n",
"|1|0 or 2|3|1|2 or 0|0|3+1, 3+1, 3+1|\n",
"|1|1|0|1|1|2|2+2, 1+3, 1+3|\n",
"|1|1|1|1|1|1|2+2, 3+1, 1+3|\n",
"|1|1|2|1|1|0|2+2, 3+1, 3+1|\n",
"\n",
"**Bo: It looks like the number of 3s in a pair totals three if one die has both 2s, or to two if the 2s are split.**\n",
"\n",
"Ali: Great. I've got one more property we could use. Consider the sums of 6-sided Sicherman and standard pairs:"
]
},
{
@ -1217,7 +1230,7 @@
"\n",
"Ali: So consider the die [1, 3, 3, 3, 4, 5]. What do we know about the dice that it can possibly pair with?\n",
"\n",
"**Bo: OK, that die has a biggest side of 5, so it can only pair with dice that have a biggest side of 12 - 5 = 7. It has a sum of 19, so it can only pair with dice that have a sum of 42 - 19 = 23. And it has no 2s, so it can only pair with dice that have two 2s.**\n",
"**Bo: OK, that die has a biggest side of 5, so it can only pair with dice that have a biggest side of 12 - 5 = 7. It has a sum of 19, so it can only pair with dice that have a sum of 42 - 19 = 23. It has no 2s, so it can only pair with dice that have two 2s. And it has three 3s (and no 2s), so it can only pair with dice with no 3s.**\n",
"\n",
"Ali: I wonder how many such dice there are, out of all 226 `all_dice(6)`?"
]
@ -1251,7 +1264,7 @@
],
"source": [
"[die for die in all_dice(6) \n",
" if max(die) == 7 and sum(die) == 23 and die.count(2) == 2]"
" if max(die) == 7 and sum(die) == 23 and die.count(2) == 2 and die.count(3) == 0]"
]
},
{
@ -1293,23 +1306,23 @@
},
"outputs": [],
"source": [
"from collections import defaultdict\n",
"from collections import defaultdict, namedtuple\n",
"\n",
"Label = tuple # Type for the label of a bin in the hash table\n",
"Label = namedtuple('Label', 'sum, max, twos, threes')\n",
"\n",
"def label(die) -> Label: \n",
" \"\"\"Return a tuple of the sum of the die, the biggest side, and the number of 2's.\"\"\"\n",
" return sum(die), max(die), die.count(2)\n",
" \"\"\"Return a tuple of the sum of the die, the biggest side, and the number of 2's and 3's.\"\"\"\n",
" return Label(sum(die), max(die), die.count(2), die.count(3))\n",
"\n",
"def all_pairs(dice: List[Die]) -> Iterable[Pair]:\n",
" \"\"\"Yield all pairs of dice that could possibly be a solution to the Sicherman problem.\"\"\"\n",
" table = tabulate_dice(dice)\n",
" N = len(dice[0])\n",
" for bin1 in table:\n",
" bin2 = compatible_label(bin1, N)\n",
" if bin2 in table and bin1 <= bin2:\n",
" for A in table[bin1]:\n",
" for B in table[bin2]:\n",
" for label1 in table:\n",
" label2 = compatible_label(label1, N)\n",
" if label1 <= label2 and label2 in table:\n",
" for A in table[label1]:\n",
" for B in table[label2]:\n",
" yield (A, B)\n",
"\n",
"def tabulate_dice(dice: List[Die]) -> Dict[Label, List[Die]]:\n",
@ -1321,10 +1334,10 @@
" table[label(die)].append(die)\n",
" return table\n",
"\n",
"def compatible_label(bin1, N) -> Label: \n",
" \"\"\"Return a bin label that is compatible with bin1.\"\"\"\n",
" (sum1, biggest1, twos1) = bin1\n",
" return (N * (N + 1) - sum1, 2 * N - biggest1, 2 - twos1)"
"def compatible_label(label: Label, N) -> Label: \n",
" \"\"\"Return a bin Label that is compatible with `label` for N-sided dice.\"\"\"\n",
" threes = (2 if label.twos == 1 else 3) - label.threes\n",
" return Label(N * (N + 1) - label.sum, 2 * N - label.max, 2 - label.twos, threes)"
]
},
{
@ -1342,33 +1355,37 @@
{
"data": {
"text/plain": [
"{(12, 4, 2): [[1, 2, 2, 3, 4]],\n",
" (13, 5, 2): [[1, 2, 2, 3, 5]],\n",
" (14, 6, 2): [[1, 2, 2, 3, 6]],\n",
" (14, 5, 2): [[1, 2, 2, 4, 5]],\n",
" (15, 6, 2): [[1, 2, 2, 4, 6]],\n",
" (16, 6, 2): [[1, 2, 2, 5, 6]],\n",
" (13, 4, 1): [[1, 2, 3, 3, 4]],\n",
" (14, 5, 1): [[1, 2, 3, 3, 5]],\n",
" (15, 6, 1): [[1, 2, 3, 3, 6]],\n",
" (15, 5, 1): [[1, 2, 3, 4, 5]],\n",
" (16, 6, 1): [[1, 2, 3, 4, 6]],\n",
" (17, 6, 1): [[1, 2, 3, 5, 6], [1, 2, 4, 4, 6]],\n",
" (16, 5, 1): [[1, 2, 4, 4, 5]],\n",
" (18, 6, 1): [[1, 2, 4, 5, 6]],\n",
" (19, 6, 1): [[1, 2, 5, 5, 6]],\n",
" (14, 4, 0): [[1, 3, 3, 3, 4]],\n",
" (15, 5, 0): [[1, 3, 3, 3, 5]],\n",
" (16, 6, 0): [[1, 3, 3, 3, 6]],\n",
" (16, 5, 0): [[1, 3, 3, 4, 5]],\n",
" (17, 6, 0): [[1, 3, 3, 4, 6]],\n",
" (18, 6, 0): [[1, 3, 3, 5, 6], [1, 3, 4, 4, 6]],\n",
" (17, 5, 0): [[1, 3, 4, 4, 5]],\n",
" (19, 6, 0): [[1, 3, 4, 5, 6], [1, 4, 4, 4, 6]],\n",
" (20, 6, 0): [[1, 3, 5, 5, 6], [1, 4, 4, 5, 6]],\n",
" (18, 5, 0): [[1, 4, 4, 4, 5]],\n",
" (21, 6, 0): [[1, 4, 5, 5, 6]],\n",
" (22, 6, 0): [[1, 5, 5, 5, 6]]}"
"{Label(sum=12, max=4, twos=2, threes=1): [[1, 2, 2, 3, 4]],\n",
" Label(sum=13, max=5, twos=2, threes=1): [[1, 2, 2, 3, 5]],\n",
" Label(sum=14, max=6, twos=2, threes=1): [[1, 2, 2, 3, 6]],\n",
" Label(sum=14, max=5, twos=2, threes=0): [[1, 2, 2, 4, 5]],\n",
" Label(sum=15, max=6, twos=2, threes=0): [[1, 2, 2, 4, 6]],\n",
" Label(sum=16, max=6, twos=2, threes=0): [[1, 2, 2, 5, 6]],\n",
" Label(sum=13, max=4, twos=1, threes=2): [[1, 2, 3, 3, 4]],\n",
" Label(sum=14, max=5, twos=1, threes=2): [[1, 2, 3, 3, 5]],\n",
" Label(sum=15, max=6, twos=1, threes=2): [[1, 2, 3, 3, 6]],\n",
" Label(sum=15, max=5, twos=1, threes=1): [[1, 2, 3, 4, 5]],\n",
" Label(sum=16, max=6, twos=1, threes=1): [[1, 2, 3, 4, 6]],\n",
" Label(sum=17, max=6, twos=1, threes=1): [[1, 2, 3, 5, 6]],\n",
" Label(sum=16, max=5, twos=1, threes=0): [[1, 2, 4, 4, 5]],\n",
" Label(sum=17, max=6, twos=1, threes=0): [[1, 2, 4, 4, 6]],\n",
" Label(sum=18, max=6, twos=1, threes=0): [[1, 2, 4, 5, 6]],\n",
" Label(sum=19, max=6, twos=1, threes=0): [[1, 2, 5, 5, 6]],\n",
" Label(sum=14, max=4, twos=0, threes=3): [[1, 3, 3, 3, 4]],\n",
" Label(sum=15, max=5, twos=0, threes=3): [[1, 3, 3, 3, 5]],\n",
" Label(sum=16, max=6, twos=0, threes=3): [[1, 3, 3, 3, 6]],\n",
" Label(sum=16, max=5, twos=0, threes=2): [[1, 3, 3, 4, 5]],\n",
" Label(sum=17, max=6, twos=0, threes=2): [[1, 3, 3, 4, 6]],\n",
" Label(sum=18, max=6, twos=0, threes=2): [[1, 3, 3, 5, 6]],\n",
" Label(sum=17, max=5, twos=0, threes=1): [[1, 3, 4, 4, 5]],\n",
" Label(sum=18, max=6, twos=0, threes=1): [[1, 3, 4, 4, 6]],\n",
" Label(sum=19, max=6, twos=0, threes=1): [[1, 3, 4, 5, 6]],\n",
" Label(sum=20, max=6, twos=0, threes=1): [[1, 3, 5, 5, 6]],\n",
" Label(sum=18, max=5, twos=0, threes=0): [[1, 4, 4, 4, 5]],\n",
" Label(sum=19, max=6, twos=0, threes=0): [[1, 4, 4, 4, 6]],\n",
" Label(sum=20, max=6, twos=0, threes=0): [[1, 4, 4, 5, 6]],\n",
" Label(sum=21, max=6, twos=0, threes=0): [[1, 4, 5, 5, 6]],\n",
" Label(sum=22, max=6, twos=0, threes=0): [[1, 5, 5, 5, 6]]}"
]
},
"execution_count": 31,
@ -1384,7 +1401,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Ali: That's good! The dice are well spread out into small bins, most of them of size 1; a few of size 2.\n",
"Ali: That's good! Every die has its own singleton bin, so each die will only have to be paired with one other.\n",
"\n",
"**Bo: Let's look at some statistics for *N* = 8:**"
]
@ -1397,7 +1414,7 @@
{
"data": {
"text/plain": [
"(5728, 395, 6039)"
"(5728, 938, 1559)"
]
},
"execution_count": 32,
@ -1415,7 +1432,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Bo: This says there are 5,728 8-sided dice; they're sorted into 395 bins, and `all_pairs` only needs to look at 6,039 pairs, not the 32 million pairs that the old version of `all_pairs` would need to consider.**\n",
"**Bo: This says there are 5,728 8-sided dice; they're sorted into 938 labeled bins, and `all_pairs` only needs to look at 1,559 pairs, not the 32 million pairs that the old version of `all_pairs` would need to consider.**\n",
"\n",
"Ali: That's fantastic. Why are there so few pairs to consider? Less than one pair per die?\n",
"\n",
@ -1430,44 +1447,25 @@
{
"data": {
"text/plain": [
"[(0, 192),\n",
" (1, 30),\n",
" (2, 25),\n",
" (3, 16),\n",
" (5, 13),\n",
" (6, 11),\n",
" (11, 11),\n",
" (16, 10),\n",
" (4, 9),\n",
" (8, 8),\n",
" (9, 6),\n",
" (32, 6),\n",
" (7, 6),\n",
" (14, 5),\n",
" (30, 4),\n",
" (13, 4),\n",
" (55, 3),\n",
" (25, 3),\n",
" (29, 3),\n",
"[(0, 603),\n",
" (1, 123),\n",
" (2, 54),\n",
" (3, 36),\n",
" (4, 28),\n",
" (5, 23),\n",
" (11, 15),\n",
" (7, 12),\n",
" (6, 12),\n",
" (16, 5),\n",
" (8, 5),\n",
" (12, 5),\n",
" (9, 4),\n",
" (18, 3),\n",
" (20, 3),\n",
" (10, 2),\n",
" (17, 2),\n",
" (48, 2),\n",
" (49, 2),\n",
" (30, 2),\n",
" (29, 2),\n",
" (19, 2),\n",
" (12, 2),\n",
" (23, 2),\n",
" (90, 1),\n",
" (58, 1),\n",
" (88, 1),\n",
" (81, 1),\n",
" (51, 1),\n",
" (28, 1),\n",
" (76, 1),\n",
" (42, 1),\n",
" (21, 1),\n",
" (37, 1)]"
" (42, 1)]"
]
},
"execution_count": 33,
@ -1491,11 +1489,11 @@
},
"source": [
"**Bo: OK, that was kind of dense, but what it says is:**\n",
"- **Of the 395 bins in the *N* = 8 table, 192 of them have a compatible bin with zero dice in it.**\n",
"- **That means that half the time, we don't have to do *any* checking of pairs.**\n",
"- **Of the 938 bins in the *N* = 8 table, 603 of them have a compatible bin with zero dice in it.**\n",
"- **That means that 2/3 the time, we don't have to do *any* checking of pairs.**\n",
"- **That's the main reason why the number of pairs is less than the number of dice.**\n",
"- **30 bins have a compatible bin with just 1 die, 25 with just 2 dice, and so on.**\n",
"- **So for most bins, there will be zero checking of pairs, or just a few checks.**\n",
"- **123 bins have a compatible bin with just 1 die, 54 with just 2 dice, and so on.**\n",
"- **So for over 80% of bins, there will be zero checking of pairs, or just one or two.**\n",
"\n",
"Ali: Amazing!\n",
"\n",
@ -1524,8 +1522,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 495 ms, sys: 2.27 ms, total: 498 ms\n",
"Wall time: 497 ms\n"
"CPU times: user 217 ms, sys: 1.88 ms, total: 219 ms\n",
"Wall time: 218 ms\n"
]
},
{
@ -1563,7 +1561,7 @@
}
},
"source": [
"Ali: Excellent! Very fast; we got the same answers as before for 27, and we got **three** solutions for 8 and one for 9, all in half a second. \n",
"Ali: Excellent! Very fast; we got the same answers as before for 27, and we got **three** solutions for 8 and one for 9, all in a few milliseconds! \n",
"\n",
"I'm confident we can [go to 11](https://www.youtube.com/watch?v=hW008FcKr3Q):"
]
@ -1577,8 +1575,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 6.03 s, sys: 17 ms, total: 6.04 s\n",
"Wall time: 6.05 s\n"
"CPU times: user 2.07 s, sys: 17.4 ms, total: 2.09 s\n",
"Wall time: 2.09 s\n"
]
},
{
@ -1593,7 +1591,7 @@
}
],
"source": [
"%time sicherman(10)"
"%time sicherman(10) # here 7.22 s ([1, 2, 2, 3, 3, 4, 4, 5, 5, 6], [1, 3, 5, 6, 7, 8, 9, 10, 12, 14])]"
]
},
{
@ -1605,8 +1603,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 1min 28s, sys: 206 ms, total: 1min 28s\n",
"Wall time: 1min 28s\n"
"CPU times: user 26.4 s, sys: 299 ms, total: 26.7 s\n",
"Wall time: 26.8 s\n"
]
},
{
@ -1628,7 +1626,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Bo: Why not 12? It will take at least 10 or 15 minutes, so we can go get a coffee and come back to see the result.**"
"**Bo: Why not 12? It will take 5 minutes or so, so we can go get a coffee and come back to see the result.**"
]
},
{
@ -1640,8 +1638,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 19min 29s, sys: 1.57 s, total: 19min 31s\n",
"Wall time: 19min 32s\n"
"CPU times: user 5min 18s, sys: 2.05 s, total: 5min 20s\n",
"Wall time: 7min 30s\n"
]
},
{
@ -1657,10 +1655,10 @@
" [1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13]),\n",
" ([1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8],\n",
" [1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16]),\n",
" ([1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9],\n",
" [1, 2, 3, 7, 7, 8, 8, 9, 9, 13, 14, 15]),\n",
" ([1, 2, 3, 3, 4, 5, 7, 8, 9, 9, 10, 11],\n",
" [1, 2, 4, 5, 5, 6, 8, 9, 9, 10, 12, 13])]"
" [1, 2, 4, 5, 5, 6, 8, 9, 9, 10, 12, 13]),\n",
" ([1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9],\n",
" [1, 2, 3, 7, 7, 8, 8, 9, 9, 13, 14, 15])]"
]
},
"execution_count": 37,
@ -1683,11 +1681,39 @@
}
},
"source": [
"Ali: Let's see what we got. \n",
"Ali: Wow! Seven distinct solutions for *N* = 12. Why 7?\n",
"\n",
"**Bo: I don't know. I can make a table summarizing the results, but I can't explain or predict them.**\n",
"\n",
"\n",
"\n",
" N Count First of Dice Pair Second of Dice Pair\n",
" ― ――――― ―――――――――――――――――― ―――――――――――――――――――\n",
" 2 0\n",
" 3 0\n",
" 4 1 [1, 2, 2, 3] [1, 3, 3, 5]\n",
" 5 0\n",
" 6 1 [1, 2, 2, 3, 3, 4] [1, 3, 4, 5, 6, 8]\n",
" 7 0\n",
" 8 3 [1, 2, 2, 3, 3, 4, 4, 5] [1, 3, 5, 5, 7, 7, 9, 11]\n",
" [1, 2, 2, 3, 5, 6, 6, 7] [1, 3, 3, 5, 5, 7, 7, 9]\n",
" [1, 2, 3, 3, 4, 4, 5, 6] [1, 2, 5, 5, 6, 6, 9, 10]\n",
" 9 1 [1, 2, 2, 3, 3, 3, 4, 4, 5] [1, 4, 4, 7, 7, 7, 10, 10, 13]\n",
" 10 1 [1, 2, 2, 3, 3, 4, 4, 5, 5, 6] [1, 3, 5, 6, 7, 8, 9, 10, 12, 14]\n",
" 11 0\n",
" 12 7 [1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6] [1, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 18]\n",
" [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7] [1, 3, 5, 7, 7, 9, 9, 11, 11, 13, 15, 17]\n",
" [1, 2, 2, 3, 3, 4, 7, 8, 8, 9, 9, 10] [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14]\n",
" [1, 2, 2, 3, 5, 6, 6, 7, 9, 10, 10, 11] [1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13]\n",
" [1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8] [1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16]\n",
" [1, 2, 3, 3, 4, 5, 7, 8, 9, 9, 10, 11] [1, 2, 4, 5, 5, 6, 8, 9, 9, 10, 12, 13]\n",
" [1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9] [1, 2, 3, 7, 7, 8, 8, 9, 9, 13, 14, 15]\n",
" \n",
"\n",
"\n",
"**Bo: I think we can stop here.**\n",
"\n",
"Wow! Seven distinct solutions for *N* = 12. Why 7?\n",
"\n",
"**Bo: I don't know, but I think we can stop here.**\n",
"\n",
"Ali: I agree. But I still have some questions:\n",
"\n",
@ -1697,6 +1723,7 @@
"- Does the fact that 8 has 3 solutions have anything to do with the fact that 8 is a perfect cube?\n",
"- What about the 7 solutions for 12? 12 has 6 factors; does that matter?\n",
"- But 9 is a perfect square, and it only has 1 solution.\n",
"- Could we make this 10 times faster? 100 times?\n",
"- Could we handle greater values of *N* if we worked with [generating functions](https://en.wikipedia.org/wiki/Sicherman_dice)?\n",
"- What about Sicherman triples (3 nonstandard dice with the same distribution of sums as 3 standard dice)?\n",
"\n",
@ -1704,6 +1731,13 @@
"\n",
"Ali: Hi reader! Let us know what you find out!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {