Add files via upload

This commit is contained in:
Peter Norvig 2024-05-08 17:41:19 -07:00 committed by GitHub
parent 97329053b3
commit 083374aca9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1220 additions and 986 deletions

View File

@ -11,9 +11,9 @@
} }
}, },
"source": [ "source": [
"<div style=\"text-align:right\"><i>Peter Norvig<br>Jan 2016<br>revised 2018, 2020, 2021, 2023</i></div>\n", "<div style=\"text-align:right\"><i>Peter Norvig<br>Jan 2016<br>last revised 2024</i></div>\n",
"\n", "\n",
"# Number Expression Puzzles: Countdowns, Four 4s, Five 5s, ...\n", "# Number Expression Puzzles: Countdowns, Four 4s, Five 5s, etc.\n",
"\n", "\n",
"In this notebook we solve a range of related puzzles that all involve making mathematical expressions by combining numbers and operations in various ways to make target numeric values. First some imports, and then we can look at the first problem." "In this notebook we solve a range of related puzzles that all involve making mathematical expressions by combining numbers and operations in various ways to make target numeric values. First some imports, and then we can look at the first problem."
] ]
@ -32,10 +32,10 @@
"from math import sqrt, factorial, floor, ceil\n", "from math import sqrt, factorial, floor, ceil\n",
"from operator import add, sub, mul, neg, truediv as div\n", "from operator import add, sub, mul, neg, truediv as div\n",
"from typing import List, Tuple, Dict, Union, Sequence, Collection, Set, Optional\n", "from typing import List, Tuple, Dict, Union, Sequence, Collection, Set, Optional\n",
"import functools\n", "from functools import lru_cache\n",
"import re\n", "import re\n",
"\n", "\n",
"cache = functools.lru_cache(None)" "cache = lru_cache(None)"
] ]
}, },
{ {
@ -55,7 +55,7 @@
"\n", "\n",
"*Fill in the blanks so that this equation makes arithmetical sense:*\n", "*Fill in the blanks so that this equation makes arithmetical sense:*\n",
"\n", "\n",
"*10 ␣ 9 ␣ 8 ␣ 7 ␣ 6 ␣ 5 ␣ 4 ␣ 3 ␣ 2 ␣ 1 = 2016*\n", " 10 ␣ 9 ␣ 8 ␣ 7 ␣ 6 ␣ 5 ␣ 4 ␣ 3 ␣ 2 ␣ 1 = 2016\n",
"\n", "\n",
"*You are allowed to use *only* the four basic arithmetical operations: +, -, &times;, ÷. But brackets (parentheses) can be used wherever needed. So, for example, the solution could begin as either:*\n", "*You are allowed to use *only* the four basic arithmetical operations: +, -, &times;, ÷. But brackets (parentheses) can be used wherever needed. So, for example, the solution could begin as either:*\n",
"\n", "\n",
@ -93,9 +93,9 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"Numbers = Tuple[int] # A sequence of integers, like (10, 9, 8)\n", "Numbers = Tuple[int, ...] # A sequence of integers, like (10, 9, 8)\n",
"Exp = str # An expression is represented as a string, like '(10+(9-8))'\n", "Exp = str # An expression is represented as a string, like '(10+(9-8))'\n",
"ExpTable = Dict[float, Exp] # A table is a dict, like {11: '(10+(9-8))', ...}\n", "ExpTable = Dict[float, Exp] # A table is a {value: exp} dict, like {11: '(10+(9-8))', ...}\n",
" \n", " \n",
"@cache\n", "@cache\n",
"def expressions(numbers: Numbers) -> ExpTable:\n", "def expressions(numbers: Numbers) -> ExpTable:\n",
@ -114,10 +114,10 @@
" table[L + R] = Lexp + '+' + Rexp\n", " table[L + R] = Lexp + '+' + Rexp\n",
" return table\n", " return table\n",
" \n", " \n",
"def splits(sequence) -> List[Tuple[Sequence, Sequence]]:\n", "def splits(numbers) -> List[Tuple[Numbers, Numbers]]:\n",
" \"\"\"Split sequence into two non-empty parts, in all ways.\"\"\"\n", " \"\"\"Split numbers into two non-empty subsequences, in all possible ways.\"\"\"\n",
" return [(sequence[:i], sequence[i:]) \n", " return [(numbers[:i], numbers[i:]) \n",
" for i in range(1, len(sequence))]" " for i in range(1, len(numbers))]"
] ]
}, },
{ {
@ -164,8 +164,8 @@
"assert expressions((2, 1)) == {1: '(2-1)', 2: '(2*1)', 3: '(2+1)'}\n", "assert expressions((2, 1)) == {1: '(2-1)', 2: '(2*1)', 3: '(2+1)'}\n",
"assert expressions((3, 2)) == {1.5: '(3/2)', 6: '(3*2)', 1: '(3-2)', 5: '(3+2)'}\n", "assert expressions((3, 2)) == {1.5: '(3/2)', 6: '(3*2)', 1: '(3-2)', 5: '(3+2)'}\n",
"assert expressions((3, 2, 1)) == {0: '((3-2)-1)', 0.5: '((3/2)-1)', 1: '((3-2)*1)',\n", "assert expressions((3, 2, 1)) == {0: '((3-2)-1)', 0.5: '((3/2)-1)', 1: '((3-2)*1)',\n",
" 1.5: '((3/2)*1)', 2: '((3-2)+1)', 2.5: '((3/2)+1)', 3: '(3*(2-1))',\n", " 1.5: '((3/2)*1)', 2: '((3-2)+1)', 2.5: '((3/2)+1)', 3: '(3*(2-1))', 4: '((3+2)-1)', \n",
" 4: '((3+2)-1)', 5: '((3+2)*1)', 6: '((3+2)+1)', 7: '((3*2)+1)', 9: '(3*(2+1))'}\n", " 5: '((3+2)*1)', 6: '((3+2)+1)', 7: '((3*2)+1)', 9: '(3*(2+1))'}\n",
"assert expressions((3, 2, 1))[7] == '((3*2)+1)'\n", "assert expressions((3, 2, 1))[7] == '((3*2)+1)'\n",
"\n", "\n",
"assert splits((3, 2, 1)) == [((3,), (2, 1)), ((3, 2), (1,))]\n", "assert splits((3, 2, 1)) == [((3,), (2, 1)), ((3, 2), (1,))]\n",
@ -208,8 +208,8 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"CPU times: user 21.9 s, sys: 667 ms, total: 22.6 s\n", "CPU times: user 19.4 s, sys: 511 ms, total: 19.9 s\n",
"Wall time: 22.7 s\n" "Wall time: 19.9 s\n"
] ]
}, },
{ {
@ -273,7 +273,8 @@
" 2026: '((((10+((((9*8)*7)*(6-5))*4))+3)-2)-1)',\n", " 2026: '((((10+((((9*8)*7)*(6-5))*4))+3)-2)-1)',\n",
" 2027: '((((10+((((9*8)*7)*(6-5))*4))+3)-2)*1)',\n", " 2027: '((((10+((((9*8)*7)*(6-5))*4))+3)-2)*1)',\n",
" 2028: '((((10+((((9*8)*7)*(6-5))*4))+3)-2)+1)',\n", " 2028: '((((10+((((9*8)*7)*(6-5))*4))+3)-2)+1)',\n",
" 2029: '(((((((10*9)+8)*7)*6)-((5*4)*3))/2)+1)'}" " 2029: '(((((((10*9)+8)*7)*6)-((5*4)*3))/2)+1)',\n",
" 2030: '(((((((10-(9/8))+(7*6))*5)*4)-3)*2)+1)'}"
] ]
}, },
"execution_count": 5, "execution_count": 5,
@ -282,7 +283,7 @@
} }
], ],
"source": [ "source": [
"{y: expressions(c10)[y] for y in range(2010, 2030)}" "{y: expressions(c10)[y] for y in range(2010, 2031)}"
] ]
}, },
{ {
@ -475,32 +476,11 @@
"id": "CyTarLLEKEA-", "id": "CyTarLLEKEA-",
"outputId": "da5d0ef3-f4d5-4be5-99ee-192fe0efad6e" "outputId": "da5d0ef3-f4d5-4be5-99ee-192fe0efad6e"
}, },
"outputs": [ "outputs": [],
{
"data": {
"text/plain": [
"'Fraction(1)/(Fraction(5)-Fraction(2))'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"def exact(exp) -> str: return re.sub(r\"([0-9]+)\", r\"Fraction(\\1)\", exp)\n", "def exact(exp) -> str: return re.sub(r\"([0-9]+)\", r\"Fraction(\\1)\", exp)\n",
"\n", "\n",
"exact('1/(5-2)')" "assert exact('1/(5-2)') == 'Fraction(1)/(Fraction(5)-Fraction(2))'\n",
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"id": "ij0zaBmYKEA-"
},
"outputs": [],
"source": [
"assert eval(exact('1/(5-2)')) == Fraction(1, 3)" "assert eval(exact('1/(5-2)')) == Fraction(1, 3)"
] ]
}, },
@ -515,7 +495,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 11,
"metadata": { "metadata": {
"id": "V29kQB9DKEA-", "id": "V29kQB9DKEA-",
"outputId": "71a1824a-763d-4a9c-8462-beb881773d08" "outputId": "71a1824a-763d-4a9c-8462-beb881773d08"
@ -527,7 +507,7 @@
"44499" "44499"
] ]
}, },
"execution_count": 12, "execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -535,7 +515,7 @@
"source": [ "source": [
"sum(expression_counts(c10)[y] \n", "sum(expression_counts(c10)[y] \n",
" for y, exp in expressions(c10).items()\n", " for y, exp in expressions(c10).items()\n",
" if abs(y - 2016) < 1e-3 and eval(exact(exp)) == 2016)" " if abs(y - 2016) < 1e-10 and eval(exact(exp)) == 2016)"
] ]
}, },
{ {
@ -549,7 +529,9 @@
} }
}, },
"source": [ "source": [
"I can claim that the answer is **44,499**, but I don't have complete confidence in that claim. It was easy to verify that `'(((((((((10*9)+8)*7)-6)-5)-4)*3)+2)+1)'` is a correct solution for `expressions(c10)[2016]` by doing simple arithmetic. But there is no simple test to verify that 44,499 is correct; I would want code reviews and tests, and hopefully an independent implementation. And of course, if you have a different definition of \"distinct solution,\" you will get a different answer." "I believe the correct answer is **44,499**. \n",
"\n",
"However I don't have complete confidence in that claim. It was easy to verify that `'(((((((((10*9)+8)*7)-6)-5)-4)*3)+2)+1)'` is a correct solution for `expressions(c10)[2016]` by doing simple arithmetic. But there is no simple test to verify that 44,499 is correct; I would want code reviews and tests, and hopefully an independent implementation. And of course, if you have a different definition of \"distinct solution,\" you will get a different answer."
] ]
}, },
{ {
@ -573,7 +555,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 12,
"metadata": { "metadata": {
"id": "EtbIiPJtKEA_", "id": "EtbIiPJtKEA_",
"outputId": "86fcbddb-4773-4132-e7f4-9dda388881c2" "outputId": "86fcbddb-4773-4132-e7f4-9dda388881c2"
@ -594,7 +576,7 @@
" 9: '(((4/4)+4)+4)'}" " 9: '(((4/4)+4)+4)'}"
] ]
}, },
"execution_count": 13, "execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -659,7 +641,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 13,
"metadata": { "metadata": {
"id": "YO8f1DE_KEA_" "id": "YO8f1DE_KEA_"
}, },
@ -691,7 +673,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 14,
"metadata": { "metadata": {
"id": "JvaPXzvYKEA_" "id": "JvaPXzvYKEA_"
}, },
@ -737,7 +719,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 15,
"metadata": { "metadata": {
"button": false, "button": false,
"id": "valCpAKPKEA_", "id": "valCpAKPKEA_",
@ -801,11 +783,11 @@
" \"\"\"All the operations in OPERATIONS with given arity whose code symbol is one of `ops`.\"\"\"\n", " \"\"\"All the operations in OPERATIONS with given arity whose code symbol is one of `ops`.\"\"\"\n",
" return [op for op in OPERATIONS[arity] if op.symbol in ops]\n", " return [op for op in OPERATIONS[arity] if op.symbol in ops]\n",
"\n", "\n",
"def splits(sequence, start=1) -> List[Tuple[Sequence, Sequence]]:\n", "def splits(numbers, start=1) -> List[Tuple[Numbers, Numbers]]:\n",
" \"\"\"Split sequence into two parts, in all ways.\n", " \"\"\"Split numbers into two subsequences, in all ways.\n",
" If start=1, the two parts are non-empty. If start=0, allow empty left part.\"\"\"\n", " If start=1, the two parts are non-empty. If start=0, allow empty left part.\"\"\"\n",
" return [(sequence[:i], sequence[i:]) \n", " return [(numbers[:i], numbers[i:]) \n",
" for i in range(start, len(sequence))]" " for i in range(start, len(numbers))]"
] ]
}, },
{ {
@ -819,7 +801,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 16,
"metadata": { "metadata": {
"id": "AEynbSq9KEA_" "id": "AEynbSq9KEA_"
}, },
@ -842,7 +824,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 17,
"metadata": { "metadata": {
"id": "mJJ8AxFXKEA_" "id": "mJJ8AxFXKEA_"
}, },
@ -868,16 +850,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"{1: '1', 2: '2', 0.5: '(1/2)', -1: '(1-2)', 3: '(1+2)'}" "{1: '1', 2: '2', -1: '(1-2)', 0.5: '(1/2)', 3: '(1+2)'}"
] ]
}, },
"execution_count": 19, "execution_count": 18,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -902,7 +884,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 19,
"metadata": { "metadata": {
"button": false, "button": false,
"id": "ndmqhDXnKEBA", "id": "ndmqhDXnKEBA",
@ -953,7 +935,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 20,
"metadata": { "metadata": {
"id": "N43Lq2hKKEBA", "id": "N43Lq2hKKEBA",
"outputId": "51a24d77-2e45-453b-b329-0e9f24b4efed" "outputId": "51a24d77-2e45-453b-b329-0e9f24b4efed"
@ -963,9 +945,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Can make 0 to 72 with (4, 4, 4, 4), ops=\"+-*/^_√!.,\", permute=False. [721,878 table entries]\n", "Can make 0 to 72 with (4, 4, 4, 4), ops=\"+-*/^_√!.,\", permute=False. [721,700 table entries]\n",
"\n", "\n",
" 0: 44-44 15: 4+(44/4) 30: (4+(4+4))/.4 45: 44+(4/4) 60: 44+(4*4) \n", " 0: 44-44 15: 4+(44/4) 30: (4*(4+4))-√4 45: 44+(4/4) 60: 44+(4*4) \n",
" 1: 44/44 16: .4*(44-4) 31: 4!+((4+4!)/4) 46: 4-(√4-44) 61: (4/4)+(4!/.4) \n", " 1: 44/44 16: .4*(44-4) 31: 4!+((4+4!)/4) 46: 4-(√4-44) 61: (4/4)+(4!/.4) \n",
" 2: (4+44)/4! 17: (4!+44)/4 32: 44-(4!/√4) 47: 4!+(4!-(4/4)) 62: (4*(4*4))-√4 \n", " 2: (4+44)/4! 17: (4!+44)/4 32: 44-(4!/√4) 47: 4!+(4!-(4/4)) 62: (4*(4*4))-√4 \n",
" 3: √((44/4)-√4) 18: (44/√4)-4 33: 4+(4!+(√4/.4)) 48: 44+√(4*4) 63: ((4^4)-4)/4 \n", " 3: √((44/4)-√4) 18: (44/√4)-4 33: 4+(4!+(√4/.4)) 48: 44+√(4*4) 63: ((4^4)-4)/4 \n",
@ -1003,7 +985,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 21,
"metadata": { "metadata": {
"button": false, "button": false,
"id": "ZWCn9F1_KEBA", "id": "ZWCn9F1_KEBA",
@ -1020,7 +1002,7 @@
"'((4+4)!/(4!-4))'" "'((4+4)!/(4!-4))'"
] ]
}, },
"execution_count": 22, "execution_count": 21,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1063,7 +1045,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 22,
"metadata": { "metadata": {
"id": "e807aDInKEBA", "id": "e807aDInKEBA",
"outputId": "e672d88a-bc1d-456d-da6b-b720c878e939" "outputId": "e672d88a-bc1d-456d-da6b-b720c878e939"
@ -1073,13 +1055,13 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Can make 0 to 30 with (2, 2, 2, 2), ops=\"+-*/^_√!.,\", permute=False. [112,539 table entries]\n", "Can make 0 to 30 with (2, 2, 2, 2), ops=\"+-*/^_√!.,\", permute=False. [112,543 table entries]\n",
"\n", "\n",
" 0: 22-22 6: √((22/2)-2)! 12: (2+22)/2 18: 22-(2^2) 24: 2+(√22^2) 30: (2+(2^2))/.2 \n", " 0: 22-22 6: √((22/2)-2)! 12: (2+22)/2 18: 22-(2*2) 24: 2+(√22^2) 30: (2+(2*2))/.2 \n",
" 1: 22/22 7: 2+(2/(2*.2)) 13: 2+(22/2) 19: (2+(2-.2))/.2 25: (2-2.2)^-2 \n", " 1: 22/22 7: 2+(2/(2*.2)) 13: 2+(22/2) 19: (2+(2-.2))/.2 25: (2-2.2)^-2 \n",
" 2: (2^2)!-22 8: 2+(2+(2^2)) 14: (2^(2^2))-2 20: 22-(√2^2) 26: 2+(2+22) \n", " 2: (2*2)!-22 8: 2+(2+(2*2)) 14: (2^(2*2))-2 20: 22-(√2^2) 26: 2+(2+22) \n",
" 3: √((22/2)-2) 9: (22/2)-2 15: (2+(2/2))/.2 21: 22-(2/2) 27: 22+(√.2^-2) \n", " 3: √((22/2)-2) 9: (22/2)-2 15: (2+(2/2))/.2 21: 22-(2/2) 27: 22+(√.2^-2) \n",
" 4: .2*(22-2) 10: 22/2.2 16: 2*(2*(2^2)) 22: √22*√22 28: 2+(2+(2^2)!) \n", " 4: .2*(22-2) 10: 22/2.2 16: 2*(2*(2*2)) 22: √22*√22 28: 2+(2+(2*2)!) \n",
" 5: 2+(2+(2/2)) 11: 22/(√2^2) 17: 22-(√.2^-2) 23: 22+(2/2) 29: 2+(2+(.2^-2))\n" " 5: 2+(2+(2/2)) 11: 22/(√2^2) 17: 22-(√.2^-2) 23: 22+(2/2) 29: 2+(2+(.2^-2))\n"
] ]
} }
@ -1099,7 +1081,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 23,
"metadata": { "metadata": {
"id": "Ll4xl6TOKEBA", "id": "Ll4xl6TOKEBA",
"outputId": "850ea56d-da8b-4f1f-c684-ba75f1c60afb" "outputId": "850ea56d-da8b-4f1f-c684-ba75f1c60afb"
@ -1109,7 +1091,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Can make 0 to 61 with (9, 9, 9, 9), ops=\"+-*/^_√!.,\", permute=False. [791,279 table entries]\n", "Can make 0 to 61 with (9, 9, 9, 9), ops=\"+-*/^_√!.,\", permute=False. [791,247 table entries]\n",
"\n", "\n",
" 0: 99-99 13: 9+(√9+(9/9)) 26: (9*√9)-(9/9) 39: √9!+(99/√9) 52: √9!*(9-(√9/9)) \n", " 0: 99-99 13: 9+(√9+(9/9)) 26: (9*√9)-(9/9) 39: √9!+(99/√9) 52: √9!*(9-(√9/9)) \n",
" 1: 99/99 14: √9+(99/9) 27: 9*√(9.9-.9) 40: (9-√9)!/(9+9) 53: (9*√9!)-(9/9) \n", " 1: 99/99 14: √9+(99/9) 27: 9*√(9.9-.9) 40: (9-√9)!/(9+9) 53: (9*√9!)-(9/9) \n",
@ -1142,7 +1124,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 24,
"metadata": { "metadata": {
"button": false, "button": false,
"id": "Mmed82RmKEBA", "id": "Mmed82RmKEBA",
@ -1157,14 +1139,14 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Can make 0 to 38 with (5, 5, 5, 5), ops=\"+-*/^_√!.,\", permute=False. [345,331 table entries]\n", "Can make 0 to 38 with (5, 5, 5, 5), ops=\"+-*/^_√!.,\", permute=False. [345,303 table entries]\n",
"\n", "\n",
" 0: 55-55 7: 5+((5+5)/5) 14: (5!/5)-(5+5) 21: (5+5.5)/.5 28: .5+(5*5.5) 35: (5!+55)/5 \n", " 0: 55-55 7: 5+((5+5)/5) 14: (5!/5)-(5+5) 21: (5+5.5)/.5 28: .5+(5*5.5) 35: (5!+55)/5 \n",
" 1: 55/55 8: 5.5+(5*.5) 15: (5*5)-(5+5) 22: 55/(5*.5) 29: 5+(5-(5/5))! 36: (.5*5!)-(5!/5)\n", " 1: 55/55 8: 5.5+(5*.5) 15: (5*5)-(5+5) 22: 55/(5*.5) 29: 5+(5-(5/5))! 36: (.5*5!)-(5!/5)\n",
" 2: 5!/(5+55) 9: 5+(5-(5/5)) 16: 5+(55/5) 23: 55-(.5^-5) 30: 55-(5*5) 37: 5+(.5^-√(5*5))\n", " 2: 5!/(5+55) 9: 5+(5-(5/5)) 16: 5+(55/5) 23: 55-(.5^-5) 30: 55-(5*5) 37: 5+(.5^-√(5*5))\n",
" 3: 5.5-(5*.5) 10: 55/5.5 17: 5+(5!/(5+5)) 24: √(5+(55/5))! 31: 55-(5!/5) 38: ((5!/5)-5)/.5 \n", " 3: 5.5-(5*.5) 10: 55/5.5 17: 5+(5!/(5+5)) 24: √(5+(55/5))! 31: 55-(5!/5) 38: ((5!/5)-5)/.5 \n",
" 4: √(5+(55/5)) 11: 5.5+5.5 18: ((5!-5)/5)-5 25: .5*(55-5) 32: (5.5-5)^-5 \n", " 4: √(5+(55/5)) 11: 5.5+5.5 18: ((5!-5)/5)-5 25: .5*(55-5) 32: (5.5-5)^-5 \n",
" 5: (.5*5!)-55 12: (5+55)/5 19: (5!-(5*5))/5 26: (5/5)+(5*5) 33: .5*(5!*.55) \n", " 5: (.5*5!)-55 12: (5+55)/5 19: (5!-(5*5))/5 26: (5*5)+(5/5) 33: .5*(5!*.55) \n",
" 6: (55/5)-5 13: (5!-55)/5 20: 5*(5-(5/5)) 27: (5*5.5)-.5 34: 5+(5+(5!/5)) \n" " 6: (55/5)-5 13: (5!-55)/5 20: 5*(5-(5/5)) 27: (5*5.5)-.5 34: 5+(5+(5!/5)) \n"
] ]
} }
@ -1196,24 +1178,24 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"10: 2-(0-(1*8)) 20-(1+9) 20/(2-0) 20/(2/1) 20/√(2+2) √(20*(2+3)) 20*(2/4) \n", "10: 2-(0-(1*8)) 20-(1+9) 20/(2-0) 20/(2*1) 20/√(2*2) √(20*(2+3)) 20*(2/4) \n",
" 9: 2+(0-(1-8)) (2*0)+(1*9) (20/2)-0! (20/2)-1 (20-2)/2 2+(0!+(2*3)) (20-2)/√4 \n", " 9: 2+(0-(1-8)) (2*0)+(1*9) (20/2)-0! (20/2)-1 (20-2)/2 2+(0!+(2*3)) (20-2)/√4 \n",
" 8: (2*0)+(1*8) (2*0)-(1-9) 2-(0-(2+0!)!) 2-(0-(2+1)!) (20/2)-2 20-(2*3!) (20/2)-√4 \n", " 8: (2*0)+(1*8) (2*0)-(1-9) 2-(0-(2+0!)!) 2-(0-(2+1)!) (20/2)-2 20-(2*3!) (20/2)-√4 \n",
" 7: (2*0)-(1-8) (20+1)/√9 (2*(0!+2))+0! (2*(0!+2))+1 2+(0!+(2+2)) (20/2)-3 2+√(0!+24) \n", " 7: (2*0)-(1-8) (20+1)/√9 (2*(0!+2))+0! (2*(0!+2))+1 2+(0!+(2*2)) (20/2)-3 2+√(0!+24) \n",
" 6: √(2*(0+18)) (2+(0/19)!)! (2+(0/20)!)! (2+(0/21)!)! √((20-2)*2) (-20+23)! (20/2)-4 \n", " 6: √(2*(0+18)) (2+(0*19)!)! (2+(0*20)!)! (2+(0*21)!)! √((20-2)*2) (-20+23)! (20/2)-4 \n",
" 5: 2-(0-√(1+8)) 20/(1+√9) 2-(0-(2+0!)) 2-(0-(2+1)) 20/(2+2) √(2-(0-23)) 20/(2+√4) \n", " 5: 2-(0-√(1+8)) 20/(1+√9) 2-(0-(2+0!)) 2-(0-(2+1)) 20/(2*2) √(2-(0-23)) 20/(2*√4) \n",
" 4: √(-2-(0-18)) √(20-(1+√9)) 2-(0-(2-0)) 2-(0-(2/1)) √(20-(2+2)) 20/(2+3) -20+24 \n", " 4: √(-2-(0-18)) √(20-(1+√9)) 2-(0-(2-0)) 2-(0-(2*1)) √(20-(2*2)) 20/(2+3) -20+24 \n",
" 3: 2+(0/18)! 2+(0/19)! 2+(0/20)! 2+(0/21)! 2+(0/22)! -20+23 2+(0/24)! \n", " 3: 2+(0*18)! 2+(0*19)! 2+(0*20)! 2+(0*21)! 2+(0*22)! -20+23 2+(0*24)! \n",
" 2: 20-18 2-(0/19) 2-(0/20) 2-(0/21) -20+22 2-(0/23) √(-20+24) \n", " 2: 20-18 2-(0*19) 2-(0*20) 2-(0*21) -20+22 2-(0*23) √(-20+24) \n",
" 1: 2-(0/18)! 20-19 20/20 -20+21 2-(0/22)! 2-(0/23)! 2-(0/24)! \n", " 1: 2-(0*18)! 20-19 20/20 -20+21 2-(0*22)! 2-(0*23)! 2-(0*24)! \n",
" 0: 2*(0/18) 2*(0/19) 20-20 2*(0/21) 2*(0/22) 2*(0/23) 2*(0/24) \n" " 0: 2*(0*18) 2*(0*19) 20-20 2*(0*21) 2*(0*22) 2*(0*23) 2*(0*24) \n"
] ]
} }
], ],
@ -1244,7 +1226,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1253,7 +1235,7 @@
"'(((3^2)-3)*4)'" "'(((3^2)-3)*4)'"
] ]
}, },
"execution_count": 27, "execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1275,7 +1257,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 27,
"metadata": { "metadata": {
"id": "dLZMMnH-KEBB", "id": "dLZMMnH-KEBB",
"outputId": "9e964cef-f10d-49fd-faf6-bc171de07344" "outputId": "9e964cef-f10d-49fd-faf6-bc171de07344"
@ -1285,14 +1267,14 @@
"data": { "data": {
"text/plain": [ "text/plain": [
"{'(((3^2)-3)*4)',\n", "{'(((3^2)-3)*4)',\n",
" '(((4/2)^3)*3)',\n", " '(((4-2)^3)*3)',\n",
" '(3*((4/2)^3))',\n", " '(3*((4-2)^3))',\n",
" '(3*(4^(3/2)))',\n", " '(3*(4^(3/2)))',\n",
" '(3/((2/4)^3))',\n", " '(3/((2/4)^3))',\n",
" '(4*((3^2)-3))'}" " '(4*((3^2)-3))'}"
] ]
}, },
"execution_count": 28, "execution_count": 27,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1317,7 +1299,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 28,
"metadata": { "metadata": {
"id": "snhb7k8OKEBB", "id": "snhb7k8OKEBB",
"outputId": "44f3cf49-aa56-4900-f510-3eedb4970307" "outputId": "44f3cf49-aa56-4900-f510-3eedb4970307"
@ -1331,7 +1313,7 @@
" '((2^3)+(8+8))',\n", " '((2^3)+(8+8))',\n",
" '((8-(3+2))*8)',\n", " '((8-(3+2))*8)',\n",
" '((8^2)/(8/3))',\n", " '((8^2)/(8/3))',\n",
" '(3*((8^2)/8))',\n", " '(3*((8*2)-8))',\n",
" '(3/(2/(8+8)))',\n", " '(3/(2/(8+8)))',\n",
" '(3/(8/(8^2)))',\n", " '(3/(8/(8^2)))',\n",
" '(8*(8-(3+2)))',\n", " '(8*(8-(3+2)))',\n",
@ -1339,7 +1321,7 @@
" '(8+(8+(2^3)))'}" " '(8+(8+(2^3)))'}"
] ]
}, },
"execution_count": 29, "execution_count": 28,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1350,7 +1332,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 29,
"metadata": { "metadata": {
"id": "gia8RdaUKEBB", "id": "gia8RdaUKEBB",
"outputId": "46852452-3ebd-4718-ad7a-52d4fc6de9bf" "outputId": "46852452-3ebd-4718-ad7a-52d4fc6de9bf"
@ -1368,7 +1350,7 @@
" '(10-(2*(3-10)))'}" " '(10-(2*(3-10)))'}"
] ]
}, },
"execution_count": 30, "execution_count": 29,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1379,7 +1361,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 30,
"metadata": { "metadata": {
"id": "VhhMQ33sKEBB", "id": "VhhMQ33sKEBB",
"outputId": "66fe6857-f940-409b-aa2a-04fdb00e064e" "outputId": "66fe6857-f940-409b-aa2a-04fdb00e064e"
@ -1391,7 +1373,7 @@
"{'(8/(3-(8/3)))'}" "{'(8/(3-(8/3)))'}"
] ]
}, },
"execution_count": 31, "execution_count": 30,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1402,7 +1384,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 31,
"metadata": { "metadata": {
"id": "nbcNqMdFKEBB", "id": "nbcNqMdFKEBB",
"outputId": "e3d17354-e297-4ded-9193-5fe615902072" "outputId": "e3d17354-e297-4ded-9193-5fe615902072"
@ -1417,15 +1399,15 @@
" '(2*(6*(6/3)))',\n", " '(2*(6*(6/3)))',\n",
" '(2*(6/(3/6)))',\n", " '(2*(6/(3/6)))',\n",
" '(2/(3/(6*6)))',\n", " '(2/(3/(6*6)))',\n",
" '(6*(2*(6/3)))',\n",
" '(6*(2/(3/6)))',\n", " '(6*(2/(3/6)))',\n",
" '(6*(2^(6/3)))',\n",
" '(6*(6*(2/3)))',\n", " '(6*(6*(2/3)))',\n",
" '(6*(6/(3/2)))',\n", " '(6*(6/(3/2)))',\n",
" '(6/(3/(2*6)))',\n", " '(6/(3/(2*6)))',\n",
" '(6/(3/(6*2)))'}" " '(6/(3/(6*2)))'}"
] ]
}, },
"execution_count": 32, "execution_count": 31,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1436,7 +1418,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 32,
"metadata": { "metadata": {
"id": "L8SAsmSrKEBB", "id": "L8SAsmSrKEBB",
"outputId": "33874782-4dcd-460e-dfaf-140fe71bf502" "outputId": "33874782-4dcd-460e-dfaf-140fe71bf502"
@ -1448,7 +1430,7 @@
"{'((5^2)-(0^0))'}" "{'((5^2)-(0^0))'}"
] ]
}, },
"execution_count": 33, "execution_count": 32,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1470,7 +1452,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 33,
"metadata": { "metadata": {
"id": "VDlW5eWVKEBB", "id": "VDlW5eWVKEBB",
"outputId": "d2d3e78c-485f-407a-8888-579ba423f1d2" "outputId": "d2d3e78c-485f-407a-8888-579ba423f1d2"
@ -1482,7 +1464,7 @@
"{'(10-(6/(13-11))!)!'}" "{'(10-(6/(13-11))!)!'}"
] ]
}, },
"execution_count": 34, "execution_count": 33,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1493,7 +1475,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 34,
"metadata": { "metadata": {
"id": "5GYEEXhnKEBB", "id": "5GYEEXhnKEBB",
"outputId": "bdee3db6-f560-4b4f-ba2a-036b4d8ee1b3" "outputId": "bdee3db6-f560-4b4f-ba2a-036b4d8ee1b3"
@ -1505,7 +1487,7 @@
"{'(8/((1^9)+1))!', '(8/(1+(1^9)))!'}" "{'(8/((1^9)+1))!', '(8/(1+(1^9)))!'}"
] ]
}, },
"execution_count": 35, "execution_count": 34,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1516,7 +1498,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 35,
"metadata": { "metadata": {
"id": "pqZLLXXCKEBB", "id": "pqZLLXXCKEBB",
"outputId": "97da7ef1-2033-45d0-f636-1ea7bc14d126" "outputId": "97da7ef1-2033-45d0-f636-1ea7bc14d126"
@ -1528,7 +1510,7 @@
"{'(9!/(7!+(7!+7!)))'}" "{'(9!/(7!+(7!+7!)))'}"
] ]
}, },
"execution_count": 36, "execution_count": 35,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1551,7 +1533,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1563,79 +1545,79 @@
"0038: 0-(0-(3*8)) 1149: (1-4)*(1-9) 1458: (1+5)*(8-4) 2348: (2-(3-4))*8 3355: (5*5)-(3/3) 4477: (4-(4/7))*7 \n", "0038: 0-(0-(3*8)) 1149: (1-4)*(1-9) 1458: (1+5)*(8-4) 2348: (2-(3-4))*8 3355: (5*5)-(3/3) 4477: (4-(4/7))*7 \n",
"0046: 0-(0-(4*6)) 1155: 1*((5*5)-1) 1459: ((4-1)*5)+9 2349: 2/(3/(4*9)) 3356: 3+((3*5)+6) 4478: 4+((4*7)-8) \n", "0046: 0-(0-(4*6)) 1155: 1*((5*5)-1) 1459: ((4-1)*5)+9 2349: 2/(3/(4*9)) 3356: 3+((3*5)+6) 4478: 4+((4*7)-8) \n",
"0128: 0+((1+2)*8) 1156: 1*((5-1)*6) 1466: ((1+4)*6)-6 2355: 2-(3-(5*5)) 3357: 3*((3*5)-7) 4479: 4*(4-(7-9)) \n", "0128: 0+((1+2)*8) 1156: 1*((5-1)*6) 1466: ((1+4)*6)-6 2355: 2-(3-(5*5)) 3357: 3*((3*5)-7) 4479: 4*(4-(7-9)) \n",
"0136: 0+((1+3)*6) 1157: (1+1)*(5+7) 1467: (1-(4-7))*6 2356: (2-(3-5))*6 3359: (3+3)*(9-5) 4488: 4+(4+(8+8)) \n", "0136: 0+((1+3)*6) 1157: (1+1)*(5+7) 1467: (1-(4-7))*6 2356: (2*(3*5))-6 3359: (3+3)*(9-5) 4488: 4+(4+(8+8)) \n",
"0137: 0+((1+7)*3) 1158: (5-(1+1))*8 1468: (1-(4-6))*8 2357: 2+((3*5)+7) 3366: 3*((6/3)+6) 4489: (4*9)-(4+8) \n", "0137: 0+((1+7)*3) 1158: (5-(1+1))*8 1468: (1-(4-6))*8 2357: 2+((3*5)+7) 3366: 3*((6/3)+6) 4489: (4*9)-(4+8) \n",
"0138: 0+(1*(3*8)) 1166: (1+1)*(6+6) 1469: 6*(9-(1+4)) 2358: (2*(3+5))+8 3367: 3-((3-6)*7) 4555: 4*(5+(5/5)) \n", "0138: 0+(1*(3*8)) 1166: (1+1)*(6+6) 1469: 6*(9-(1+4)) 2358: (2*(3+5))+8 3367: 3-((3-6)*7) 4555: 4-(5-(5*5)) \n",
"0139: 0-((1-9)*3) 1168: 6/((1+1)/8) 1477: (1+7)*(7-4) 2359: 2*(3*(9-5)) 3368: ((3*3)-6)*8 4556: 4*(5/(5/6)) \n", "0139: 0-((1-9)*3) 1168: 6/((1+1)/8) 1477: (1+7)*(7-4) 2359: 2*(3*(9-5)) 3368: ((3*3)-6)*8 4556: 4/(5/(5*6)) \n",
"0145: 0+((1+5)*4) 1169: ((1+1)*9)+6 1478: 1*((7-4)*8) 2366: 2/(3/(6*6)) 3369: (3*3)+(6+9) 4557: 4*(7-(5/5)) \n", "0145: 0+((1+5)*4) 1169: ((1+1)*9)+6 1478: 1*((7-4)*8) 2366: 2/(3/(6*6)) 3369: (3*3)+(6+9) 4557: 4*(7-(5/5)) \n",
"0146: 0+(1*(4*6)) 1188: ((1+1)*8)+8 1479: (1-9)*(4-7) 2367: ((2*7)-6)*3 3377: (3+(3/7))*7 4558: (4-(5/5))*8 \n", "0146: 0+(1*(4*6)) 1188: ((1+1)*8)+8 1479: (1-9)*(4-7) 2367: ((2*7)-6)*3 3377: (3+(3/7))*7 4558: (4-(5/5))*8 \n",
"0147: 0-((1-7)*4) 1224: (1+2)*(2*4) 1488: 1*((4*8)-8) 2368: ((2+8)*3)-6 3378: (3*3)+(7+8) 4559: 4-(5*(5-9)) \n", "0147: 0-((1-7)*4) 1224: (1+2)*(2*4) 1488: 1*((4*8)-8) 2368: ((2+8)*3)-6 3378: (3*3)+(7+8) 4559: 4-(5*(5-9)) \n",
"0148: 0-((1-4)*8) 1225: (1+5)*(2+2) 1489: 1+((4*8)-9) 2369: 2*(6-(3-9)) 3379: 3+(7/(3/9)) 4566: 4*(5+(6/6)) \n", "0148: 0-((1-4)*8) 1225: (1+5)*(2*2) 1489: 1+((4*8)-9) 2369: 2*(6-(3-9)) 3379: 3+(7/(3/9)) 4566: 4*(5+(6/6)) \n",
"0155: 0-(1-(5*5)) 1226: 1*(2*(2*6)) 1555: (5-(1/5))*5 2377: (2*7)+(3+7) 3388: 8/(3-(8/3)) 4567: 4*(5-(6-7)) \n", "0155: 0-(1-(5*5)) 1226: 1*(2*(2*6)) 1555: (5-(1/5))*5 2377: (2*7)+(3+7) 3388: 8/(3-(8/3)) 4567: 4*(5-(6-7)) \n",
"0156: 0-((1-5)*6) 1227: 2*(2*(7-1)) 1556: ((1+5)*5)-6 2378: 2*(7-(3-8)) 3389: (3*(3+8))-9 4568: (4+(5-6))*8 \n", "0156: 0-((1-5)*6) 1227: 2*(2*(7-1)) 1556: ((1+5)*5)-6 2378: 2*(7-(3-8)) 3389: (3*(3+8))-9 4568: (4+(5-6))*8 \n",
"0226: 0+(2*(2*6)) 1228: (2-(1-2))*8 1559: (1+5)*(9-5) 2379: 2*((3*7)-9) 3399: 3+(3+(9+9)) 4569: 4+(5+(6+9)) \n", "0226: 0+(2*(2*6)) 1228: (2-(1-2))*8 1559: (1+5)*(9-5) 2379: 2*((3*7)-9) 3399: 3+(3+(9+9)) 4569: 4+(5+(6+9)) \n",
"0234: 0+(2*(3*4)) 1229: (1+(2+9))*2 1566: 1*((5*6)-6) 2388: ((2*8)-8)*3 3444: ((3+4)*4)-4 4577: 4*(5+(7/7)) \n", "0234: 0+(2*(3*4)) 1229: (1+(2+9))*2 1566: 1*((5*6)-6) 2388: ((2*8)-8)*3 3444: ((3+4)*4)-4 4577: 4*(5+(7/7)) \n",
"0236: 0+((2+6)*3) 1233: (1+3)*(2*3) 1567: 1+((5*6)-7) 2389: 8/(2/(9-3)) 3445: 3+((4*4)+5) 4578: 4*(5-(7-8)) \n", "0236: 0+((2+6)*3) 1233: (1+3)*(2*3) 1567: 1+((5*6)-7) 2389: 8/(2/(9-3)) 3445: 3+((4*4)+5) 4578: 4*(5-(7-8)) \n",
"0238: (0/2)+(3*8) 1234: 1*(2*(3*4)) 1568: (1-(5-8))*6 2399: (2*3)+(9+9) 3446: (3+(4/4))*6 4579: (4*7)+(5-9) \n", "0238: (0*2)+(3*8) 1234: 1*(2*(3*4)) 1568: (1-(5-8))*6 2399: (2*3)+(9+9) 3446: (3+(4/4))*6 4579: (4*7)+(5-9) \n",
"0239: 0+(2*(3+9)) 1235: (1+2)*(3+5) 1569: 1*(6*(9-5)) 2444: 2*(4+(4+4)) 3447: 3*((4/4)+7) 4588: 4*(5+(8/8)) \n", "0239: 0+(2*(3+9)) 1235: (1+2)*(3+5) 1569: 1*(6*(9-5)) 2444: 2*(4+(4+4)) 3447: 3*((4/4)+7) 4588: 4*(5+(8/8)) \n",
"0244: 0+((2+4)*4) 1236: 1*((2+6)*3) 1578: (1-(5-7))*8 2445: ((2+5)*4)-4 3448: 3*(4/(4/8)) 4589: 4*(5-(8-9)) \n", "0244: 0+((2+4)*4) 1236: 1*((2+6)*3) 1578: (1-(5-7))*8 2445: ((2*5)-4)*4 3448: 3/(4/(4*8)) 4589: 4*(5-(8-9)) \n",
"0246: (0/2)+(4*6) 1237: 1+(2+(3*7)) 1579: (1-7)*(5-9) 2446: 2+((4*4)+6) 3449: 3*(9-(4/4)) 4599: 4*(5+(9/9)) \n", "0246: (0*2)+(4*6) 1237: 1+(2+(3*7)) 1579: (1-7)*(5-9) 2446: 2+((4*4)+6) 3449: 3*(9-(4/4)) 4599: 4*(5+(9/9)) \n",
"0248: 0+(2*(4+8)) 1238: (1+3)*(8-2) 1588: 1*((8-5)*8) 2447: 2*(4*(7-4)) 3455: 3-(4-(5*5)) 4666: 4*(6/(6/6)) \n", "0248: 0+(2*(4+8)) 1238: (1+3)*(8-2) 1588: 1*((8-5)*8) 2447: 2*(4*(7-4)) 3455: 3-(4-(5*5)) 4666: 4/(6/(6*6)) \n",
"0257: 0+(2*(5+7)) 1239: 1*(2*(3+9)) 1589: (1-9)*(5-8) 2448: (2+(4/4))*8 3456: (3-(4-5))*6 4667: 4*(6/(7-6)) \n", "0257: 0+(2*(5+7)) 1239: 1*(2*(3+9)) 1589: (1-9)*(5-8) 2448: (2*(4*4))-8 3456: (3-(4-5))*6 4667: 4*(6*(7-6)) \n",
"0258: 0-((2-5)*8) 1244: 1*((2+4)*4) 1599: 1+(5+(9+9)) 2449: (4*(9-2))-4 3457: (3*4)+(5+7) 4668: 4+(6+(6+8)) \n", "0258: 0-((2-5)*8) 1244: 1*((2+4)*4) 1599: 1+(5+(9+9)) 2449: (4*(9-2))-4 3457: (3*4)+(5+7) 4668: 4+(6+(6+8)) \n",
"0266: 0+(2*(6+6)) 1245: (2-(1-5))*4 1666: ((6-1)*6)-6 2455: (2*(5+5))+4 3458: 3/((5-4)/8) 4669: (4*9)-(6+6) \n", "0266: 0+(2*(6+6)) 1245: (2-(1-5))*4 1666: ((6-1)*6)-6 2455: (2*(5+5))+4 3458: 3*((5-4)*8) 4669: (4*9)-(6+6) \n",
"0268: 0+(6/(2/8)) 1246: (2-1)*(4*6) 1668: 6/(1-(6/8)) 2456: (2*(4+5))+6 3459: 3*(4-(5-9)) 4677: 4*(6/(7/7)) \n", "0268: 0+(6/(2/8)) 1246: (2-1)*(4*6) 1668: 6/(1-(6/8)) 2456: (2*(4+5))+6 3459: 3*(4-(5-9)) 4677: 4*(6-(7-7)) \n",
"0269: 0+((2*9)+6) 1247: (1-(2-7))*4 1669: (1-(6-9))*6 2457: 4/(2/(5+7)) 3466: (3*4)+(6+6) 4678: (4+(6-7))*8 \n", "0269: 0+((2*9)+6) 1247: (1-(2-7))*4 1669: (1-(6-9))*6 2457: 4/(2/(5+7)) 3466: (3*4)+(6+6) 4678: (4+(6-7))*8 \n",
"0288: 0+((2*8)+8) 1248: 1*(2*(4+8)) 1679: (1+7)*(9-6) 2458: 2*((4*5)-8) 3468: 3*(4*(8-6)) 4679: 6/(4/(7+9)) \n", "0288: 0+((2*8)+8) 1248: 1*(2*(4+8)) 1679: (1+7)*(9-6) 2458: 2*((4*5)-8) 3468: 3*(4*(8-6)) 4679: 6/(4/(7+9)) \n",
"0334: 0+((3+3)*4) 1249: ((1+9)*2)+4 1688: (1-(6-8))*8 2459: (2+4)*(9-5) 3469: (3-(6-9))*4 4688: 4*(6/(8/8)) \n", "0334: 0+((3+3)*4) 1249: ((1+9)*2)+4 1688: (1-(6-8))*8 2459: (2+4)*(9-5) 3469: (3-(6-9))*4 4688: 4*(6-(8-8)) \n",
"0335: 0+(3*(3+5)) 1255: 1-(2-(5*5)) 1689: 1+(6+(8+9)) 2466: (2-(4-6))*6 3477: 3-((4-7)*7) 4689: 4*(6/(9-8)) \n", "0335: 0+(3*(3+5)) 1255: 1-(2-(5*5)) 1689: 1+(6+(8+9)) 2466: (2-(4-6))*6 3477: 3+((4*7)-7) 4689: 4*(6*(9-8)) \n",
"0337: 0+(3+(3*7)) 1256: (1-(2-5))*6 1699: 1*(6+(9+9)) 2467: 2+((4*7)-6) 3478: (4*(7-3))+8 4699: 4*(6/(9/9)) \n", "0337: 0+(3+(3*7)) 1256: (1-(2-5))*6 1699: 1*(6+(9+9)) 2467: 2+((4*7)-6) 3478: (4*(7-3))+8 4699: 4*(6-(9-9)) \n",
"0338: (0/3)+(3*8) 1257: 1*(2*(5+7)) 1779: 1+(7+(7+9)) 2468: 2/(4/(6*8)) 3479: (3*(4+7))-9 4777: 4*(7-(7/7)) \n", "0338: (0*3)+(3*8) 1257: 1*(2*(5+7)) 1779: 1+(7+(7+9)) 2468: 2/(4/(6*8)) 3479: (3*(4+7))-9 4777: 4*(7-(7/7)) \n",
"0339: 0-(3-(3*9)) 1258: 1*((5-2)*8) 1788: 1+(7+(8+8)) 2469: (2+(4/6))*9 3489: 3+(4+(8+9)) 4778: 4*(7+(7-8)) \n", "0339: 0-(3-(3*9)) 1258: 1*((5-2)*8) 1788: 1+(7+(8+8)) 2469: (2+(4/6))*9 3489: 3+(4+(8+9)) 4778: 4*(7+(7-8)) \n",
"0344: 0+(3*(4+4)) 1259: ((1+2)*5)+9 1789: 1*(7+(8+9)) 2477: (2*(7+7))-4 3499: (3*(9-4))+9 4788: 4*(7-(8/8)) \n", "0344: 0+(3*(4+4)) 1259: ((1+2)*5)+9 1789: 1*(7+(8+9)) 2477: (2*(7+7))-4 3499: (3*(9-4))+9 4788: 4*(7-(8/8)) \n",
"0346: (0/3)+(4*6) 1266: 1*(2*(6+6)) 1799: 7-(1-(9+9)) 2478: ((2*7)-8)*4 3556: (3+(5/5))*6 4789: 4*(7+(8-9)) \n", "0346: (0*3)+(4*6) 1266: 1*(2*(6+6)) 1799: 7-(1-(9+9)) 2478: ((2*7)-8)*4 3556: (3+(5/5))*6 4789: 4*(7+(8-9)) \n",
"0348: (0/4)+(3*8) 1267: (1-7)*(2-6) 1888: 1*(8+(8+8)) 2479: (2*4)+(7+9) 3557: 3*((5/5)+7) 4799: 4*(7-(9/9)) \n", "0348: (0*4)+(3*8) 1267: (1-7)*(2-6) 1888: 1*(8+(8+8)) 2479: (2*4)+(7+9) 3557: 3*((5/5)+7) 4799: 4*(7-(9/9)) \n",
"0349: 0-((3-9)*4) 1268: 1/(2/(6*8)) 1889: 8-(1-(8+9)) 2488: (2*4)+(8+8) 3558: 3*(5/(5/8)) 4888: (4-(8/8))*8 \n", "0349: 0-((3-9)*4) 1268: 1/(2/(6*8)) 1889: 8-(1-(8+9)) 2488: (2*4)+(8+8) 3558: 3/(5/(5*8)) 4888: (4-(8/8))*8 \n",
"0358: (0/5)+(3*8) 1269: 1*((2*9)+6) 2223: 2*(2*(2*3)) 2489: 8*(9-(2+4)) 3559: 3*(9-(5/5)) 4889: (4+(8-9))*8 \n", "0358: (0*5)+(3*8) 1269: 1*((2*9)+6) 2223: 2*(2*(2*3)) 2489: 8*(9-(2+4)) 3559: 3*(9-(5/5)) 4889: (4+(8-9))*8 \n",
"0359: 0+((3*5)+9) 1277: ((7*7)-1)/2 2224: 2*(2*(2+4)) 2499: 2+(4+(9+9)) 3566: (3-(5-6))*6 4899: (4-(9/9))*8 \n", "0359: 0+((3*5)+9) 1277: ((7*7)-1)/2 2224: 2*(2*(2+4)) 2499: 2+(4+(9+9)) 3566: (3-(5-6))*6 4899: (4-(9/9))*8 \n",
"0366: 0+((3*6)+6) 1278: 1+((2*8)+7) 2225: 2*(2+(2*5)) 2557: (2*7)+(5+5) 3567: 3*(6-(5-7)) 5555: (5*5)-(5/5) \n", "0366: 0+((3*6)+6) 1278: 1+((2*8)+7) 2225: 2*(2+(2*5)) 2557: (2*7)+(5+5) 3567: 3*(6-(5-7)) 5555: (5*5)-(5/5) \n",
"0367: 0-((3-7)*6) 1279: 1+((2*7)+9) 2227: 2*((2*7)-2) 2558: (2+(5/5))*8 3568: 3/((6-5)/8) 5556: 5+((5*5)-6) \n", "0367: 0-((3-7)*6) 1279: 1+((2*7)+9) 2227: 2*((2*7)-2) 2558: (2+(5/5))*8 3568: 3*((6-5)*8) 5556: 5+((5*5)-6) \n",
"0368: 0-((3-6)*8) 1288: 1*((2*8)+8) 2228: 2*(2+(2+8)) 2559: (2*5)+(5+9) 3569: 3*(5-(6-9)) 5559: 5+(5+(5+9)) \n", "0368: 0-((3-6)*8) 1288: 1*((2*8)+8) 2228: 2*(2+(2+8)) 2559: (2*5)+(5+9) 3569: 3*(5-(6-9)) 5559: 5+(5+(5+9)) \n",
"0378: (0/7)+(3*8) 1289: (2*8)-(1-9) 2229: 2+(2*(2+9)) 2566: ((2*5)-6)*6 3578: 3-((5-8)*7) 5566: (5*5)-(6/6) \n", "0378: (0*7)+(3*8) 1289: (2*8)-(1-9) 2229: 2+(2*(2+9)) 2566: ((2*5)-6)*6 3578: 3-((5-8)*7) 5566: (5*5)-(6/6) \n",
"0388: (0/8)+(3*8) 1333: (1+3)*(3+3) 2233: 2*(2*(3+3)) 2567: (2-(5-7))*6 3579: 3+(5+(7+9)) 5567: (5*5)+(6-7) \n", "0388: (0*8)+(3*8) 1333: (1+3)*(3+3) 2233: 2*(2*(3+3)) 2567: (2-(5-7))*6 3579: 3+(5+(7+9)) 5567: (5*5)+(6-7) \n",
"0389: 0+(8/(3/9)) 1334: 1*((3+3)*4) 2234: (2+(2+4))*3 2568: 2+((5*6)-8) 3588: 3+(5+(8+8)) 5568: 5+(5+(6+8)) \n", "0389: 0+(8/(3/9)) 1334: 1*((3+3)*4) 2234: (2+(2+4))*3 2568: 2+((5*6)-8) 3588: 3+(5+(8+8)) 5568: 5+(5+(6+8)) \n",
"0445: 0+(4+(4*5)) 1335: 1*(3*(3+5)) 2235: ((2*5)-2)*3 2569: (5/(2/6))+9 3589: (3*9)+(5-8) 5577: 5+(5+(7+7)) \n", "0445: 0+(4+(4*5)) 1335: 1*(3*(3+5)) 2235: ((2*5)-2)*3 2569: (5/(2/6))+9 3589: (3*9)+(5-8) 5577: 5+(5+(7+7)) \n",
"0446: (0/4)+(4*6) 1336: ((1+6)*3)+3 2236: 2*((2*3)+6) 2577: (2*5)+(7+7) 3599: (3-9)*(5-9) 5578: (5*5)+(7-8) \n", "0446: (0*4)+(4*6) 1336: ((1+6)*3)+3 2236: 2*((2*3)+6) 2577: (2*5)+(7+7) 3599: (3-9)*(5-9) 5578: (5*5)+(7-8) \n",
"0447: 0-(4-(4*7)) 1337: 1*(3+(3*7)) 2237: 2*(2+(3+7)) 2578: ((2*5)-7)*8 3666: (3+(6/6))*6 5588: (5*5)-(8/8) \n", "0447: 0-(4-(4*7)) 1337: 1*(3+(3*7)) 2237: 2*(2+(3+7)) 2578: ((2*5)-7)*8 3666: (3+(6/6))*6 5588: (5*5)-(8/8) \n",
"0448: 0+((4*4)+8) 1338: ((1+8)*3)-3 2238: 2+(2*(3+8)) 2579: (5*7)-(2+9) 3667: 3*((6/6)+7) 5589: (5*5)+(8-9) \n", "0448: 0+((4*4)+8) 1338: ((1+8)*3)-3 2238: 2-(2-(3*8)) 2579: (5*7)-(2+9) 3667: 3*((6/6)+7) 5589: (5*5)+(8-9) \n",
"0456: (0/5)+(4*6) 1339: 1*((3*9)-3) 2239: (2+(2/3))*9 2588: (5*8)-(2*8) 3668: 3*(6/(6/8)) 5599: (5*5)-(9/9) \n", "0456: (0*5)+(4*6) 1339: 1*((3*9)-3) 2239: (2+(2/3))*9 2588: (5*8)-(2*8) 3668: 3/(6/(6*8)) 5599: (5*5)-(9/9) \n",
"0466: (0/6)+(4*6) 1344: 1*(3*(4+4)) 2244: 2*((2*4)+4) 2589: 2+(5+(8+9)) 3669: 3+(6+(6+9)) 5666: (5-(6/6))*6 \n", "0466: (0*6)+(4*6) 1344: 1*(3*(4+4)) 2244: 2*((2*4)+4) 2589: 2+(5+(8+9)) 3669: 3+(6+(6+9)) 5666: (5-(6/6))*6 \n",
"0467: (0/7)+(4*6) 1345: 1+(3+(4*5)) 2245: 2+(2+(4*5)) 2666: (2*6)+(6+6) 3677: 3*(7-(6-7)) 5667: 5+(6+(6+7)) \n", "0467: (0*7)+(4*6) 1345: 1+(3+(4*5)) 2245: 2+(2+(4*5)) 2666: (2*6)+(6+6) 3677: 3*(7-(6-7)) 5667: 5+(6+(6+7)) \n",
"0468: 0-((4-8)*6) 1346: 6/(1-(3/4)) 2246: 2*(2+(4+6)) 2667: (6+(6*7))/2 3678: 3+(6+(7+8)) 5668: 6-((5-8)*6) \n", "0468: 0-((4-8)*6) 1346: 6/(1-(3/4)) 2246: 2-(2-(4*6)) 2667: (6+(6*7))/2 3678: 3+(6+(7+8)) 5668: 6-((5-8)*6) \n",
"0469: (0/9)+(4*6) 1347: ((1+3)*7)-4 2247: 2+(2*(4+7)) 2668: (2+(6/6))*8 3679: 3*(6-(7-9)) 5669: (6*9)-(5*6) \n", "0469: (0*9)+(4*6) 1347: ((1+3)*7)-4 2247: 2+(2*(4+7)) 2668: (2+(6/6))*8 3679: 3*(6-(7-9)) 5669: (6*9)-(5*6) \n",
"0478: 0-((4-7)*8) 1348: ((1+3)*4)+8 2248: (2*(2*4))+8 2669: (2+6)*(9-6) 3688: (3+(8/8))*6 5677: (5-(7/7))*6 \n", "0478: 0-((4-7)*8) 1348: ((1+3)*4)+8 2248: (2*(2*4))+8 2669: (2+6)*(9-6) 3688: (3+(8/8))*6 5677: (5-(7/7))*6 \n",
"0488: 0+((4*8)-8) 1349: 1+((3*9)-4) 2249: 2+((2*9)+4) 2678: (2-(6-7))*8 3689: (3-(8-9))*6 5678: (5+7)*(8-6) \n", "0488: 0+((4*8)-8) 1349: 1+((3*9)-4) 2249: 2+((2*9)+4) 2678: (2-(6-7))*8 3689: (3-(8-9))*6 5678: (5+7)*(8-6) \n",
"0566: 0+((5*6)-6) 1356: 1+((3*6)+5) 2255: 2*(2+(5+5)) 2679: 2+(6+(7+9)) 3699: (3*9)+(6-9) 5679: 6-((5-7)*9) \n", "0566: 0+((5*6)-6) 1356: 1+((3*6)+5) 2255: 2*(2+(5+5)) 2679: 2+(6+(7+9)) 3699: (3*9)+(6-9) 5679: 6-((5-7)*9) \n",
"0569: 0-((5-9)*6) 1357: (1+5)*(7-3) 2256: 2+(2*(5+6)) 2688: 2+(6+(8+8)) 3777: 3*(7+(7/7)) 5688: (5+(6-8))*8 \n", "0569: 0-((5-9)*6) 1357: (1+5)*(7-3) 2256: 2+(2*(5+6)) 2688: 2+(6+(8+8)) 3777: 3*(7+(7/7)) 5688: (5+(6-8))*8 \n",
"0588: 0-((5-8)*8) 1358: 1+((3*5)+8) 2257: (2*5)+(2*7) 2689: 2/(6/(8*9)) 3778: 3*(7/(7/8)) 5689: (5+(8-9))*6 \n", "0588: 0-((5-8)*8) 1358: 1+((3*5)+8) 2257: (2*5)+(2*7) 2689: 2/(6/(8*9)) 3778: 3/(7/(7*8)) 5689: (5+(8-9))*6 \n",
"0689: 0-((6-9)*8) 1359: 1*((3*5)+9) 2258: (2*(5+8))-2 2699: (2+(6/9))*9 3779: 3*(9-(7/7)) 5699: (5*(9-6))+9 \n", "0689: 0-((6-9)*8) 1359: 1*((3*5)+9) 2258: (2*(5+8))-2 2699: (2+(6/9))*9 3779: 3*(9-(7/7)) 5699: (5*(9-6))+9 \n",
"0699: 0+(6+(9+9)) 1366: 1*((3*6)+6) 2259: 2*(5-(2-9)) 2778: 2+(7+(7+8)) 3788: 3*(7+(8/8)) 5779: (5+7)*(9-7) \n", "0699: 0+(6+(9+9)) 1366: 1*((3*6)+6) 2259: 2*(5-(2-9)) 2778: 2+(7+(7+8)) 3788: 3*(7+(8/8)) 5779: (5+7)*(9-7) \n",
"0789: 0+(7+(8+9)) 1367: 1*(6*(7-3)) 2266: (2+6)/(2/6) 2788: (2-(7-8))*8 3789: 3*(7-(8-9)) 5788: ((7-5)*8)+8 \n", "0789: 0+(7+(8+9)) 1367: 1*(6*(7-3)) 2266: (2*6)+(2*6) 2788: (2-(7-8))*8 3789: 3*(7-(8-9)) 5788: ((7-5)*8)+8 \n",
"0888: 0+(8+(8+8)) 1368: 1*((6-3)*8) 2267: (2*(2+7))+6 2789: (2*(7+9))-8 3799: 3*(7+(9/9)) 5789: (5+(7-9))*8 \n", "0888: 0+(8+(8+8)) 1368: 1*((6-3)*8) 2267: (2*(2+7))+6 2789: (2*(7+9))-8 3799: 3*(7+(9/9)) 5789: (5+(7-9))*8 \n",
"1118: (1+(1+1))*8 1369: (1-9)*(3-6) 2268: (2*(2+6))+8 2888: (2+(8/8))*8 3888: 3*(8/(8/8)) 5888: (5*8)-(8+8) \n", "1118: (1+(1+1))*8 1369: (1-9)*(3-6) 2268: (2*(2+6))+8 2888: (2+(8/8))*8 3888: 3/(8/(8*8)) 5888: (5*8)-(8+8) \n",
"1126: (1+1)*(2*6) 1377: (1-7)*(3-7) 2269: 2*((2*9)-6) 2889: (2-(8-9))*8 3889: 3*(8/(9-8)) 5889: 8/((8-5)/9) \n", "1126: (1+1)*(2*6) 1377: (1-7)*(3-7) 2269: 2*((2*9)-6) 2889: (2-(8-9))*8 3889: 3*(8*(9-8)) 5889: 8/((8-5)/9) \n",
"1127: (1+2)*(1+7) 1378: 3/(1-(7/8)) 2277: 2*(7-(2-7)) 2899: (2+(9/9))*8 3899: 3*(8/(9/9)) 6666: 6+(6+(6+6)) \n", "1127: (1+2)*(1+7) 1378: 3/(1-(7/8)) 2277: 2*(7-(2-7)) 2899: (2+(9/9))*8 3899: 3*(8-(9-9)) 6666: 6+(6+(6+6)) \n",
"1128: 1*((1+2)*8) 1379: (1+7)/(3/9) 2278: 2+((2*7)+8) 3333: (3*(3*3))-3 3999: 3*(9-(9/9)) 6668: 6*(6+(6-8)) \n", "1128: 1*((1+2)*8) 1379: (1+7)/(3/9) 2278: 2+((2*7)+8) 3333: (3*(3*3))-3 3999: 3*(9-(9/9)) 6668: 6*(6+(6-8)) \n",
"1129: (1+2)*(9-1) 1388: ((1+3)*8)-8 2288: (2*(2*8))-8 3334: 3+(3*(3+4)) 4444: 4+(4+(4*4)) 6669: 6*(6*(6/9)) \n", "1129: (1+2)*(9-1) 1388: ((1+3)*8)-8 2288: (2*(2*8))-8 3334: 3+(3*(3+4)) 4444: 4+(4+(4*4)) 6669: 6-(6*(6-9)) \n",
"1134: (1+1)*(3*4) 1389: 1/(3/(8*9)) 2289: (2*9)-(2-8) 3335: (3*3)+(3*5) 4445: 4*((4/4)+5) 6679: 6*(6+(7-9)) \n", "1134: (1+1)*(3*4) 1389: 1/(3/(8*9)) 2289: (2*9)-(2-8) 3335: (3*3)+(3*5) 4445: 4*((4/4)+5) 6679: 6*(6+(7-9)) \n",
"1135: (1+3)*(1+5) 1399: (9-1)/(3/9) 2333: 2*(3+(3*3)) 3336: 3+(3+(3*6)) 4446: 4*(4/(4/6)) 6688: 6/((8-6)/8) \n", "1135: (1+3)*(1+5) 1399: (9-1)/(3/9) 2333: 2*(3+(3*3)) 3336: 3+(3+(3*6)) 4446: 4-(4-(4*6)) 6688: 6/((8-6)/8) \n",
"1136: 1*((1+3)*6) 1444: ((1+4)*4)+4 2335: 2*((3*5)-3) 3337: 3*((3/3)+7) 4447: (4+4)*(7-4) 6689: 6-((6-8)*9) \n", "1136: 1*((1+3)*6) 1444: ((1+4)*4)+4 2335: 2*((3*5)-3) 3337: 3*((3/3)+7) 4447: (4+4)*(7-4) 6689: 6-((6-8)*9) \n",
"1137: 1*((1+7)*3) 1445: 1*(4+(4*5)) 2336: 2*(3+(3+6)) 3338: 3*(3/(3/8)) 4448: (4-(4/4))*8 6789: 6*(8/(9-7)) \n", "1137: 1*((1+7)*3) 1445: 1*(4+(4*5)) 2336: 2*(3+(3+6)) 3338: 3-(3-(3*8)) 4448: (4-(4/4))*8 6789: 6*(8/(9-7)) \n",
"1138: 1/(1/(3*8)) 1446: ((1+6)*4)-4 2337: 2*(3*(7-3)) 3339: 3*(9-(3/3)) 4449: 4-(4*(4-9)) 6799: 6-((7-9)*9) \n", "1138: 1*(1*(3*8)) 1446: ((1+6)*4)-4 2337: 2*(3*(7-3)) 3339: 3*(9-(3/3)) 4449: 4-(4*(4-9)) 6799: 6-((7-9)*9) \n",
"1139: (1+1)*(3+9) 1447: 1+((4*4)+7) 2338: (2+(3/3))*8 3344: 3*((3*4)-4) 4455: (4+(4/5))*5 6888: 8-((6-8)*8) \n", "1139: (1+1)*(3+9) 1447: 1+((4*4)+7) 2338: (2+(3/3))*8 3344: 3*((3*4)-4) 4455: (4+(4/5))*5 6888: 8-((6-8)*8) \n",
"1144: (1+(1+4))*4 1448: 1*((4*4)+8) 2339: ((2+3)*3)+9 3345: ((3/3)+5)*4 4456: 4/((5-4)/6) 6889: (8+8)/(6/9) \n", "1144: (1+(1+4))*4 1448: 1*((4*4)+8) 2339: ((2+3)*3)+9 3345: ((3/3)+5)*4 4456: 4*((5-4)*6) 6889: (8+8)/(6/9) \n",
"1145: 1*((1+5)*4) 1449: (1-(4-9))*4 2344: ((2+3)*4)+4 3346: 3/(3/(4*6)) 4457: 4*(4-(5-7)) 6899: 8/(6/(9+9)) \n", "1145: 1*((1+5)*4) 1449: (1-(4-9))*4 2344: ((2+3)*4)+4 3346: 3-(3-(4*6)) 4457: 4*(4-(5-7)) 6899: 8/(6/(9+9)) \n",
"1146: 1/(1/(4*6)) 1455: 4-((1-5)*5) 2345: 2*(3+(4+5)) 3347: 3*(4-(3-7)) 4458: (4+(4-5))*8 7889: 8-((7-9)*8) \n", "1146: 1*(1*(4*6)) 1455: 4-((1-5)*5) 2345: 2*(3+(4+5)) 3347: 3*(4-(3-7)) 4458: (4+(4-5))*8 7889: 8-((7-9)*8) \n",
"1147: 1*(4*(7-1)) 1456: 4/(1-(5/6)) 2346: 2+((3*6)+4) 3348: (3+3)*(8-4) 4468: 4*(4-(6-8)) \n", "1147: 1*(4*(7-1)) 1456: 4/(1-(5/6)) 2346: 2+((3*6)+4) 3348: (3+3)*(8-4) 4468: 4*(4-(6-8)) \n",
"1148: (1+1)*(4+8) 1457: 1+((4*7)-5) 2347: (2-(3-7))*4 3349: 3*(3-(4-9)) 4469: 4*(4/(6/9)) \n" "1148: (1+1)*(4+8) 1457: 1+((4*7)-5) 2347: (2-(3-7))*4 3349: 3*(3-(4-9)) 4469: 4*(4/(6/9)) \n"
] ]
@ -1671,7 +1653,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 37,
"metadata": { "metadata": {
"id": "CoKnbYBxKEBB", "id": "CoKnbYBxKEBB",
"outputId": "dd72b838-7b22-4080-9b29-739585881ce7" "outputId": "dd72b838-7b22-4080-9b29-739585881ce7"
@ -1681,22 +1663,22 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"6: (0!+(0!+0!))!\n", "6 = (0!+(0!+0!))!\n",
"6: (1+(1+1))!\n", "6 = (1+(1+1))!\n",
"6: (2+(2+2))\n", "6 = (2+(2*2))\n",
"6: ((3*3)-3)\n", "6 = ((3*3)-3)\n",
"6: (4+(4/√4))\n", "6 = (4+(4-√4))\n",
"6: (5+(5/5))\n", "6 = (5+(5/5))\n",
"6: (6/(6/6))\n", "6 = (6-(6-6))\n",
"6: (7-(7/7))\n", "6 = (7-(7/7))\n",
"6: (8-√√(8+8))\n", "6 = (8-√√(8+8))\n",
"6: (9-(9/√9))\n" "6 = (9-(9/√9))\n"
] ]
} }
], ],
"source": [ "source": [
"for n in range(10):\n", "for n in range(10):\n",
" print(f\"6: {expressions((n, n, n), '+-*/√!').get(6)}\")" " print(f\"6 = {expressions((n, n, n), '+-*/√!').get(6)}\")"
] ]
}, },
{ {
@ -1715,7 +1697,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 38,
"metadata": { "metadata": {
"id": "jbJsFkNZKEBC", "id": "jbJsFkNZKEBC",
"outputId": "fea9ae24-2e75-4a11-8098-162790f91625" "outputId": "fea9ae24-2e75-4a11-8098-162790f91625"
@ -1725,7 +1707,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Can make 0 to 1644 with (4, 4, 4, 4), ops=\"+-*/^_√!.,⌊⌈\", permute=False. [1,205,301 table entries]\n", "Can make 0 to 1644 with (4, 4, 4, 4), ops=\"+-*/^_√!.,⌊⌈\", permute=False. [1,205,099 table entries]\n",
"\n", "\n",
" 0: 44-44 60: 44+(4*4) 120: ⌈4.444⌉! 180: 4+(4*44) 240: √4*⌈4.44⌉! \n", " 0: 44-44 60: 44+(4*4) 120: ⌈4.444⌉! 180: 4+(4*44) 240: √4*⌈4.44⌉! \n",
" 1: 44/44 61: ⌈(.44^-⌈4.4⌉)⌉ 121: (44/4)^√4 181: ⌊(4*(√√4+44))⌋ 241: (.4+(4*4!))/.4 \n", " 1: 44/44 61: ⌈(.44^-⌈4.4⌉)⌉ 121: (44/4)^√4 181: ⌊(4*(√√4+44))⌋ 241: (.4+(4*4!))/.4 \n",
@ -1744,7 +1726,7 @@
" 14: ⌈(√44+√44)⌉ 74: 4+⌈(44/√.4)⌉ 134: 4!+(44/.4) 194: ⌈(44*4.4)⌉ 254: √4-(4-(4^4)) \n", " 14: ⌈(√44+√44)⌉ 74: 4+⌈(44/√.4)⌉ 134: 4!+(44/.4) 194: ⌈(44*4.4)⌉ 254: √4-(4-(4^4)) \n",
" 15: 4+(44/4) 75: ⌊((4+44)/√.4)⌋ 135: ⌊(4!/.44)⌋/.4 195: ⌊(√4!*(44-4))⌋ 255: (4^4)-(4/4) \n", " 15: 4+(44/4) 75: ⌊((4+44)/√.4)⌋ 135: ⌊(4!/.44)⌋/.4 195: ⌊(√4!*(44-4))⌋ 255: (4^4)-(4/4) \n",
" 16: 4*⌊4.44⌋ 76: ⌈4.4⌉!-44 136: √4*(4!+44) 196: 4+(4!*(4+4)) 256: 4^⌊4.44⌋ \n", " 16: 4*⌊4.44⌋ 76: ⌈4.4⌉!-44 136: √4*(4!+44) 196: 4+(4!*(4+4)) 256: 4^⌊4.44⌋ \n",
" 17: ⌊(4*4.44)⌋ 77: ⌈(44*(4^.4))⌉ 137: ⌈(4!/(.4*.44))⌉ 197: ⌈(44*√(4!-4))⌉ 257: (4^4)+(4/4) \n", " 17: ⌊(4*4.44)⌋ 77: ⌈(44*(4^.4))⌉ 137: ⌈(4!/(.4*.44))⌉ 197: ⌈(44*√(4!-4))⌉ 257: (4/4)+(4^4) \n",
" 18: ⌈(4*4.44)⌉ 78: ⌊(4*(4!-4.4))⌋ 138: √4*⌊(44/√.4)⌋ 198: √4*⌊(√4^√44)⌋ 258: 4-(√4-(4^4)) \n", " 18: ⌈(4*4.44)⌉ 78: ⌊(4*(4!-4.4))⌋ 138: √4*⌊(44/√.4)⌋ 198: √4*⌊(√4^√44)⌋ 258: 4-(√4-(4^4)) \n",
" 19: ⌈(444/4!)⌉ 79: ⌈(4*(4!-4.4))⌉ 139: ⌊(4^(4-.44))⌋ 199: ⌈(√4*(√4^√44))⌉ 259: ⌊(√44/(.4^4))⌋ \n", " 19: ⌈(444/4!)⌉ 79: ⌈(4*(4!-4.4))⌉ 139: ⌊(4^(4-.44))⌋ 199: ⌈(√4*(√4^√44))⌉ 259: ⌊(√44/(.4^4))⌋ \n",
" 20: 4*⌈4.44⌉ 80: 4*(44-4!) 140: 44+(4*4!) 200: 4!+(4*44) 260: 4+(4^⌊4.4⌋) \n", " 20: 4*⌈4.44⌉ 80: 4*(44-4!) 140: 44+(4*4!) 200: 4!+(4*44) 260: 4+(4^⌊4.4⌋) \n",
@ -1757,7 +1739,7 @@
" 27: ⌈(4*√44.4)⌉ 87: (√4*44)-⌈.4⌉ 147: ⌊(44^(√4^.4))⌋ 207: ⌈(44^√√4)⌉-4 267: ⌊(4!*(√4!/.44))⌋ \n", " 27: ⌈(4*√44.4)⌉ 87: (√4*44)-⌈.4⌉ 147: ⌊(44^(√4^.4))⌋ 207: ⌈(44^√√4)⌉-4 267: ⌊(4!*(√4!/.44))⌋ \n",
" 28: 44-(4*4) 88: 44+44 148: 4+(4!*⌊√44⌋) 208: ⌈(4.4^(4-.4))⌉ 268: ⌊(4!^(4*.44))⌋ \n", " 28: 44-(4*4) 88: 44+44 148: 4+(4!*⌊√44⌋) 208: ⌈(4.4^(4-.4))⌉ 268: ⌊(4!^(4*.44))⌋ \n",
" 29: 4!+⌈4.44⌉ 89: ⌈(√4*44.4)⌉ 149: ⌊(.4*(4.4^4))⌋ 209: ⌈(√⌈4.4⌉^√44)⌉ 269: ⌈(4!^(4*.44))⌉ \n", " 29: 4!+⌈4.44⌉ 89: ⌈(√4*44.4)⌉ 149: ⌊(.4*(4.4^4))⌋ 209: ⌈(√⌈4.4⌉^√44)⌉ 269: ⌈(4!^(4*.44))⌉ \n",
" 30: ⌈4.44⌉!/4 90: √4*⌈44.4⌉ 150: .4*⌈(4.4^4)⌉ 210: ⌊(44^√(4/√4))⌋ 270: ⌈(4!^(4^√(4/4!)))⌉\n", " 30: ⌈4.44⌉!/4 90: √4*⌈44.4⌉ 150: .4*⌈(4.4^4)⌉ 210: ⌊(44^√(4-√4))⌋ 270: ⌈(4!^(4^√(4/4!)))⌉\n",
" 31: 4!+⌈√44.4⌉ 91: ⌈(444/√4!)⌉ 151: ⌊(4!*√(44-4))⌋ 211: ⌊(√4!*44)⌋-4 271: ⌊((√4!^4.4)/4)⌋ \n", " 31: 4!+⌈√44.4⌉ 91: ⌈(444/√4!)⌉ 151: ⌊(4!*√(44-4))⌋ 211: ⌊(√4!*44)⌋-4 271: ⌊((√4!^4.4)/4)⌋ \n",
" 32: √4^⌈4.44⌉ 92: 4+(√4*44) 152: (4*44)-4! 212: (4^4)-44 272: 4*(4!+44) \n", " 32: √4^⌈4.44⌉ 92: 4+(√4*44) 152: (4*44)-4! 212: (4^4)-44 272: 4*(4!+44) \n",
" 33: ⌊(4*(4+4.4))⌋ 93: ⌊((4.4^4)/4)⌋ 153: ⌊(4!*(√4+4.4))⌋ 213: ⌊(44.4^√√4)⌋ 273: ⌊(4^(4!^.44))⌋ \n", " 33: ⌊(4*(4+4.4))⌋ 93: ⌊((4.4^4)/4)⌋ 153: ⌊(4!*(√4+4.4))⌋ 213: ⌊(44.4^√√4)⌋ 273: ⌊(4^(4!^.44))⌋ \n",
@ -1787,8 +1769,8 @@
" 57: ⌈(√√4*(44-4))⌉ 117: ⌈(44*√⌈√44⌉)⌉ 177: ⌊(4*44.4)⌋ 237: ⌊(√.4*(4.4^4))⌋ 297: ⌈(√√4*⌊(44^√√4)⌋)⌉\n", " 57: ⌈(√√4*(44-4))⌉ 117: ⌈(44*√⌈√44⌉)⌉ 177: ⌊(4*44.4)⌋ 237: ⌊(√.4*(4.4^4))⌋ 297: ⌈(√√4*⌊(44^√√4)⌋)⌉\n",
" 58: ⌊(.4^-4.44)⌋ 118: ⌈4.44⌉!-√4 178: ⌈(4*44.4)⌉ 238: ⌊((4+44)^√√4)⌋ 298: (⌈4.4⌉!/.4)-√4 \n", " 58: ⌊(.4^-4.44)⌋ 118: ⌈4.44⌉!-√4 178: ⌈(4*44.4)⌉ 238: ⌊((4+44)^√√4)⌋ 298: (⌈4.4⌉!/.4)-√4 \n",
" 59: ⌈(.4^-4.44)⌉ 119: ⌈4.4⌉!-(4/4) 179: ⌈(4*(√.4+44))⌉ 239: ⌈((4+44)^√√4)⌉ 299: (⌈4.4⌉!-.4)/.4 \n", " 59: ⌈(.4^-4.44)⌉ 119: ⌈4.4⌉!-(4/4) 179: ⌈(4*(√.4+44))⌉ 239: ⌈((4+44)^√√4)⌉ 299: (⌈4.4⌉!-.4)/.4 \n",
"CPU times: user 14.4 s, sys: 120 ms, total: 14.5 s\n", "CPU times: user 14.6 s, sys: 70.4 ms, total: 14.7 s\n",
"Wall time: 14.6 s\n" "Wall time: 14.7 s\n"
] ]
} }
], ],
@ -1812,7 +1794,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 39,
"metadata": { "metadata": {
"id": "4MHPG5L8KEBC", "id": "4MHPG5L8KEBC",
"outputId": "63bffec7-8b22-4bb2-cd44-6fd03f124ccf" "outputId": "63bffec7-8b22-4bb2-cd44-6fd03f124ccf"
@ -1822,7 +1804,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Can make 0 to 171 with (5, 5, 5, 5, 5), ops=\"+-*/^_√!.,\", permute=False. [14,827,653 table entries]\n", "Can make 0 to 171 with (5, 5, 5, 5, 5), ops=\"+-*/^_√!.,\", permute=False. [14,827,355 table entries]\n",
"\n", "\n",
" 0: 5*(55-55) 43: 55-(5!/(5+5)) 86: (55/.5)-(5!/5) 129: (5!-55.5)/.5 \n", " 0: 5*(55-55) 43: 55-(5!/(5+5)) 86: (55/.5)-(5!/5) 129: (5!-55.5)/.5 \n",
" 1: 5^(55-55) 44: 55-(55/5) 87: (555-5!)/5 130: 5!+(55/5.5) \n", " 1: 5^(55-55) 44: 55-(55/5) 87: (555-5!)/5 130: 5!+(55/5.5) \n",
@ -1832,7 +1814,7 @@
" 5: 5.55-.55 48: 5!/(5*(5.5-5)) 91: (5*5)+(5!*.55) 134: (5!/5)+(55/.5) \n", " 5: 5.55-.55 48: 5!/(5*(5.5-5)) 91: (5*5)+(5!*.55) 134: (5!/5)+(55/.5) \n",
" 6: 5+(55/55) 49: 55-(.5+5.5) 92: 5+(55+(.5^-5)) 135: (5!+555)/5 \n", " 6: 5+(55/55) 49: 55-(.5+5.5) 92: 5+(55+(.5^-5)) 135: (5!+555)/5 \n",
" 7: ((5+55)/5)-5 50: 55.5-5.5 93: .5+(5!-(5*5.5)) 136: 5+(5!+(55/5)) \n", " 7: ((5+55)/5)-5 50: 55.5-5.5 93: .5+(5!-(5*5.5)) 136: 5+(5!+(55/5)) \n",
" 8: .5*(5+(55/5)) 51: .5-(5-55.5) 94: 5!-((5/5)+(5*5)) 137: 5+(5!/(5/5.5)) \n", " 8: .5*(5+(55/5)) 51: .5-(5-55.5) 94: 5!-((5*5)+(5/5)) 137: 5+(5!/(5/5.5)) \n",
" 9: 5!-(555/5) 52: 55-(.5+(5*.5)) 95: (55/.55)-5 138: .5+(5*(5*5.5)) \n", " 9: 5!-(555/5) 52: 55-(.5+(5*.5)) 95: (55/.55)-5 138: .5+(5*(5*5.5)) \n",
" 10: 5!-(55+55) 53: 55.5-(5*.5) 96: 5!-√(5+(55/5))! 139: ((.5+5.5)!/5)-5 \n", " 10: 5!-(55+55) 53: 55.5-(5*.5) 96: 5!-√(5+(55/5))! 139: ((.5+5.5)!/5)-5 \n",
" 11: 55/(5.5-.5) 54: 55-(5^(5-5)) 97: 5!-(55-(.5^-5)) 140: .5*(5+(5*55)) \n", " 11: 55/(5.5-.5) 54: 55-(5^(5-5)) 97: 5!-(55-(.5^-5)) 140: .5*(5+(5*55)) \n",
@ -1841,7 +1823,7 @@
" 14: (5*5)-(55/5) 57: 55+((5+5)/5) 100: (55/.5)-(5+5) 143: 5!+(55-(.5^-5)) \n", " 14: (5*5)-(55/5) 57: 55+((5+5)/5) 100: (55/.5)-(5+5) 143: 5!+(55-(.5^-5)) \n",
" 15: 5+(55/5.5) 58: (5*.5)+55.5 101: (55.5-5)/.5 144: ((55/5)-5)!/5 \n", " 15: 5+(55/5.5) 58: (5*.5)+55.5 101: (55.5-5)/.5 144: ((55/5)-5)!/5 \n",
" 16: 5+(5.5+5.5) 59: 5-((5/5)-55) 102: 5+(5!+((5-5!)/5)) 145: 5!+(.5*(55-5)) \n", " 16: 5+(5.5+5.5) 59: 5-((5/5)-55) 102: 5+(5!+((5-5!)/5)) 145: 5!+(.5*(55-5)) \n",
" 17: 5+((5+55)/5) 60: 5+(√55*√55) 103: 55+(5!/(5*.5)) 146: 5!+((5/5)+(5*5)) \n", " 17: 5+((5+55)/5) 60: 5+(√55*√55) 103: 55+(5!/(5*.5)) 146: 5!+((5*5)+(5/5)) \n",
" 18: 5+((5!-55)/5) 61: 5.5+55.5 104: 5!-(5+(55/5)) 147: 5!-(.5-(5*5.5)) \n", " 18: 5+((5!-55)/5) 61: 5.5+55.5 104: 5!-(5+(55/5)) 147: 5!-(.5-(5*5.5)) \n",
" 19: (5*5)-(.5+5.5) 62: (55-(5!/5))/.5 105: 55-(5-55) 148: .5+(5!+(5*5.5)) \n", " 19: (5*5)-(.5+5.5) 62: (55-(5!/5))/.5 105: 55-(5-55) 148: .5+(5!+(5*5.5)) \n",
" 20: 55/(5*.55) 63: 5.5-(.5*(5-5!)) 106: (555/5)-5 149: 5+((.5+5.5)!/5) \n", " 20: 55/(5*.55) 63: 5.5-(.5*(5-5!)) 106: (555/5)-5 149: 5+((.5+5.5)!/5) \n",
@ -1867,8 +1849,8 @@
" 40: 55-(5+(5+5)) 83: (.5*5!)-((5-5!)/5) 126: 5!+((55/5)-5) 169: 5!+((5*5)+(5!/5)) \n", " 40: 55-(5+(5+5)) 83: (.5*5!)-((5-5!)/5) 126: 5!+((55/5)-5) 169: 5!+((5*5)+(5!/5)) \n",
" 41: 5!-(55+(5!/5)) 84: 5+(55+(5!/5)) 127: (5!/(5/5.5))-5 170: 5!-(√(5*5)-55) \n", " 41: 5!-(55+(5!/5)) 84: 5+(55+(5!/5)) 127: (5!/(5/5.5))-5 170: 5!-(√(5*5)-55) \n",
" 42: (5+5.5)/(.5*.5) 85: 5+(55+(5*5)) 128: 5!+(5.5+(5*.5)) 171: (5.5/(.5^5))-5 \n", " 42: (5+5.5)/(.5*.5) 85: 5+(55+(5*5)) 128: 5!+(5.5+(5*.5)) 171: (5.5/(.5^5))-5 \n",
"CPU times: user 2min 21s, sys: 2.05 s, total: 2min 23s\n", "CPU times: user 2min 13s, sys: 1.09 s, total: 2min 14s\n",
"Wall time: 2min 24s\n" "Wall time: 2min 14s\n"
] ]
} }
], ],
@ -1876,6 +1858,124 @@
"%time show((5, 5, 5, 5, 5))" "%time show((5, 5, 5, 5, 5))"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Integer Complexity\n",
"\n",
"In number theory, the **complexity of an integer** is the number of \"1\"s needed to make the integer. Different versions of the concept use different sets of operators, but in the [Wikipedia article on Integer complexity](https://en.wikipedia.org/wiki/Integer_complexity), they allow only addition and multiplication. For example with one \"1\" we can only make 1, but with two \"1\"s we can make 1 and 2, and with seven \"1\"s we can make all the integers from 1 to 12 except 11:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{1: '(1*1)', 2: '(1+1)'}"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expressions((1, 1), '+*')"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{1: '(1*(1*(1*(1*(1*(1*1))))))',\n",
" 2: '(1+(1*(1*(1*(1*(1*1))))))',\n",
" 3: '(1+(1+(1*(1*(1*(1*1))))))',\n",
" 4: '(1+(1+(1+(1*(1*(1*1))))))',\n",
" 5: '(1+(1+(1+(1+(1*(1*1))))))',\n",
" 6: '(1+(1+(1+(1+(1+(1*1))))))',\n",
" 7: '(1+(1+(1+(1+(1+(1+1))))))',\n",
" 8: '(1+(1+((1+1)*(1+(1+1)))))',\n",
" 9: '(1+((1+1)*(1+(1+(1+1)))))',\n",
" 10: '(1+((1+(1+1))*(1+(1+1))))',\n",
" 12: '((1+1)*((1+1)*(1+(1+1))))'}"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expressions(7 * (1,), '+*')"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"@cache\n",
"def complexity(end=17) -> dict:\n",
" \"\"\"A table of {i: complexity_number} for all integers i with complexity < `end`.\"\"\"\n",
" results = {}\n",
" for n in range(1, end):\n",
" for x in expressions(n * (1,), '+*'):\n",
" if x not in results:\n",
" results[x] = n\n",
" return results"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 1: 1 | 21: 9 | 41: 12 | 61: 13 | 81: 12 | 101: 15 | 121: 15 | 141: 16 | 161: 16 | 186: 16 | 225: 16 |\n",
" 2: 2 | 22: 10 | 42: 11 | 62: 13 | 82: 13 | 102: 14 | 122: 15 | 142: 16 | 162: 14 | 189: 15 | 228: 16 |\n",
" 3: 3 | 23: 11 | 43: 12 | 63: 12 | 83: 14 | 103: 15 | 123: 15 | 143: 16 | 163: 15 | 190: 16 | 234: 16 |\n",
" 4: 4 | 24: 9 | 44: 12 | 64: 12 | 84: 13 | 104: 14 | 124: 15 | 144: 14 | 164: 15 | 192: 15 | 240: 16 |\n",
" 5: 5 | 25: 10 | 45: 11 | 65: 13 | 85: 14 | 105: 14 | 125: 15 | 145: 15 | 165: 15 | 193: 16 | 243: 15 |\n",
" 6: 5 | 26: 10 | 46: 12 | 66: 13 | 86: 14 | 106: 15 | 126: 14 | 146: 15 | 166: 16 | 194: 16 | 244: 16 |\n",
" 7: 6 | 27: 9 | 47: 13 | 67: 14 | 87: 14 | 107: 16 | 127: 15 | 147: 15 | 168: 15 | 195: 16 | 246: 16 |\n",
" 8: 6 | 28: 10 | 48: 11 | 68: 13 | 88: 14 | 108: 13 | 128: 14 | 148: 15 | 169: 16 | 196: 16 | 252: 16 |\n",
" 9: 6 | 29: 11 | 49: 12 | 69: 14 | 89: 15 | 109: 14 | 129: 15 | 149: 16 | 170: 16 | 198: 16 | 256: 16 |\n",
" 10: 7 | 30: 10 | 50: 12 | 70: 13 | 90: 13 | 110: 14 | 130: 15 | 150: 15 | 171: 15 | 200: 16 | 270: 16 |\n",
" 11: 8 | 31: 11 | 51: 12 | 71: 14 | 91: 14 | 111: 14 | 131: 16 | 151: 16 | 172: 16 | 204: 16 | 288: 16 |\n",
" 12: 7 | 32: 10 | 52: 12 | 72: 12 | 92: 14 | 112: 14 | 132: 15 | 152: 15 | 174: 16 | 208: 16 | 324: 16 |\n",
" 13: 8 | 33: 11 | 53: 13 | 73: 13 | 93: 14 | 113: 15 | 133: 15 | 153: 15 | 175: 16 | 210: 16 |\n",
" 14: 8 | 34: 11 | 54: 11 | 74: 13 | 94: 15 | 114: 14 | 134: 16 | 154: 16 | 176: 16 | 216: 15 |\n",
" 15: 8 | 35: 11 | 55: 12 | 75: 13 | 95: 14 | 115: 15 | 135: 14 | 155: 16 | 180: 15 | 217: 16 |\n",
" 16: 8 | 36: 10 | 56: 12 | 76: 13 | 96: 13 | 116: 15 | 136: 15 | 156: 15 | 181: 16 | 218: 16 |\n",
" 17: 9 | 37: 11 | 57: 12 | 77: 14 | 97: 14 | 117: 14 | 137: 16 | 157: 16 | 182: 16 | 219: 16 |\n",
" 18: 8 | 38: 11 | 58: 13 | 78: 13 | 98: 14 | 118: 15 | 138: 15 | 158: 16 | 183: 16 | 220: 16 |\n",
" 19: 9 | 39: 11 | 59: 14 | 79: 14 | 99: 14 | 119: 15 | 139: 16 | 159: 16 | 184: 16 | 222: 16 |\n",
" 20: 9 | 40: 11 | 60: 12 | 80: 13 | 100: 14 | 120: 14 | 140: 15 | 160: 15 | 185: 16 | 224: 16 |\n"
]
}
],
"source": [
"def show_complexity(end=17) -> None:\n",
" \"\"\"Show a table of integer: complexity_number.\"\"\"\n",
" table = complexity(end)\n",
" show_columns([f'{x:3}: {table[x]:3} |' for x in sorted(table)])\n",
"\n",
"show_complexity()"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@ -1889,7 +1989,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": 44,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1901,7 +2001,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 45,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1936,7 +2036,7 @@
"- **Percent**: `50%` = 0.5\n", "- **Percent**: `50%` = 0.5\n",
"- **Absolute value**: `|1-3|` = 2 (redundant if you have unary minus, but add it if you like it)\n", "- **Absolute value**: `|1-3|` = 2 (redundant if you have unary minus, but add it if you like it)\n",
"- **Repeating decimal**: `.4...` = .44444444... = 4/9\n", "- **Repeating decimal**: `.4...` = .44444444... = 4/9\n",
"- **Comparison operations**: `1>(2<3)` = 0, because `(2<3)` is True, which is treated as `1`, and `1>1` is False, or `0`\n", "- **Comparison operations**: `(1<2)+(3=4)`= 0, because `(1<2)` is True, which is treated as `1`, and `3=4` is False, or `0`\n",
"- **Double factorial**: `9!!` = 9 × 7 × 5 × 3 × 1 = 945; not the same as `(9!)!`\n", "- **Double factorial**: `9!!` = 9 × 7 × 5 × 3 × 1 = 945; not the same as `(9!)!`\n",
"- **Gamma function**: `Γ(n)` = (n 1)! and works for non-integers\n", "- **Gamma function**: `Γ(n)` = (n 1)! and works for non-integers\n",
"- **Prime counting function**: `π(n)` = number of primes ≲ n; e.g. `π(5)` = 3\n", "- **Prime counting function**: `π(n)` = number of primes ≲ n; e.g. `π(5)` = 3\n",

File diff suppressed because one or more lines are too long