From 69ed6d8f87ac85f447a37be7ef702876396f1875 Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Wed, 11 Jan 2023 10:09:29 -0800 Subject: [PATCH] Add files via upload --- ipynb/Countdown.ipynb | 2415 ++++++++++------------------------------- 1 file changed, 567 insertions(+), 1848 deletions(-) diff --git a/ipynb/Countdown.ipynb b/ipynb/Countdown.ipynb index fa1ea08..fa84c95 100644 --- a/ipynb/Countdown.ipynb +++ b/ipynb/Countdown.ipynb @@ -4,6 +4,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "at_OswnbKEA2", "new_sheet": false, "run_control": { "read_only": false @@ -20,7 +21,9 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "id": "M4UuEIKOKEA4" + }, "outputs": [], "source": [ "from collections import Counter, defaultdict, namedtuple\n", @@ -29,14 +32,18 @@ "from itertools import product, permutations\n", "from math import sqrt, factorial, floor, ceil\n", "from operator import add, sub, mul, neg, truediv as div\n", - "from typing import List, Tuple, Dict, Union, Sequence, Set, Optional\n", - "import re" + "from typing import List, Tuple, Dict, Union, Sequence, Collection, Set, Optional\n", + "import re\n", + "import functools\n", + "\n", + "cache = functools.cache if 'cache' in functools.__dict__ else functools.lru_cache(None)" ] }, { "cell_type": "markdown", "metadata": { "button": false, + "id": "acj0YasvKEA5", "new_sheet": false, "run_control": { "read_only": false @@ -47,21 +54,21 @@ "\n", "On January 1, 2016 Alex Bellos [posed](http://www.theguardian.com/science/2016/jan/04/can-you-solve-it-complete-the-equation-10-9-8-7-6-5-4-3-2-1-2016) (and subsequently [answered](http://www.theguardian.com/science/2016/jan/04/did-you-solve-it-complete-the-equation-10-9-8-7-6-5-4-3-2-1-2016)) this New Year's puzzle:\n", "\n", + "- *Fill in the blanks so that this equation makes arithmetical sense:*\n", "\n", - "> Fill in the blanks so that this equation makes arithmetical sense:\n", - ">\n", - "> 10 ␣ 9 ␣ 8 ␣ 7 ␣ 6 ␣ 5 ␣ 4 ␣ 3 ␣ 2 ␣ 1 = 2016\n", - ">\n", - "> You are allowed to use *only* the four basic arithmetical operations: +, -, ×, ÷. But brackets (parentheses) can be used wherever needed. So, for example, the solution could begin as either\n", - ">\n", - "> (10 + 9) × (8 ...\n", - "> 10 + (9 × 8) ..." + " 10 ␣ 9 ␣ 8 ␣ 7 ␣ 6 ␣ 5 ␣ 4 ␣ 3 ␣ 2 ␣ 1 = 2016\n", + "\n", + "- *You are allowed to use *only* the four basic arithmetical operations: +, -, ×, ÷. But brackets (parentheses) can be used wherever needed. So, for example, the solution could begin as either:*\n", + "\n", + " (10 + 9) × (8 ...\n", + " 10 + (9 × 8) ..." ] }, { "cell_type": "markdown", "metadata": { "button": false, + "id": "Ief1-PqFKEA6", "new_sheet": false, "run_control": { "read_only": false @@ -70,9 +77,9 @@ "source": [ "To solve this specific problem, I'll first solve the more general problem: \n", "\n", - "> Given any sequence of numbers, place operations and brackets to form a dict of `{value: expression}` for every value that can be made. \n", + "- *Given any sequence of numbers, place operations and brackets to form a dict of `{value: expression}` for every value that can be made.*\n", "\n", - "I'll define `expressions(numbers)` to return an **expression table**: a dict of `{value: expression}` for all expressions (strings) whose numeric value is `value` that can be made from `numbers`, for example:\n", + "I'll define `expressions(numbers)` to return an **expression table**: a dict of `{value: expression}` for all expressions (strings) whose numeric value is a `value` that can be made using all the `numbers`, for example:\n", "\n", " expressions((10,)) ⇒ {10: '10'}\n", " expressions((9, 8)) ⇒ {1: '(9-8)', 1.125: '(9/8)', 17: '(9+8)', 72: '(9*8)'}\n", @@ -83,11 +90,13 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, + "metadata": { + "id": "dyr0KdidKEA6" + }, "outputs": [], "source": [ - "Exp = str\n", - "ExpTable = Dict[float, Exp] # A table of {11: '(10+(9-8))', ...}\n", + "Exp = str # An expression is a string, like '(10+(9-8))'\n", + "ExpTable = Dict[float, Exp] # A table, like {11: '(10+(9-8))', ...}\n", " \n", "@lru_cache(None)\n", "def expressions(numbers: tuple) -> ExpTable:\n", @@ -106,16 +115,17 @@ " table[L + R] = Lexp + '+' + Rexp\n", " return table\n", " \n", - "def splits(sequence) -> List[Tuple[Sequence, Sequence]]:\n", + "def splits(sequence, start=1) -> List[Tuple[Sequence, Sequence]]:\n", " \"Split sequence into two non-empty parts, in all ways.\"\n", " return [(sequence[:i], sequence[i:]) \n", - " for i in range(1, len(sequence))]" + " for i in range(start, len(sequence))]" ] }, { "cell_type": "markdown", "metadata": { "button": false, + "id": "ViyfBGBUKEA7", "new_sheet": false, "run_control": { "read_only": false @@ -130,6 +140,7 @@ "execution_count": 3, "metadata": { "button": false, + "id": "8Ur6YFeGKEA7", "new_sheet": false, "run_control": { "read_only": false @@ -138,32 +149,16 @@ "outputs": [], "source": [ "assert splits((3, 2, 1)) == [((3,), (2, 1)), \n", - " ((3, 2), (1,))]\n", + " ((3, 2), (1,))]\n", "\n", "assert expressions((3,)) == {3: '3'}\n", - "assert expressions((2, 1)) == {2: '(2*1)', # Could have been '(2/1)'\n", - " 1: '(2-1)', \n", - " 3: '(2+1)'}\n", - "\n", - "assert expressions((3, 2)) == {1.5: '(3/2)', \n", - " 6: '(3*2)', \n", - " 1: '(3-2)', \n", - " 5: '(3+2)'}\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((1,)) == {1: '1'}\n", "\n", - "assert expressions((3, 2, 1)) == {\n", - " 1.5: '((3/2)*1)',\n", - " 6: '((3+2)+1)',\n", - " 1: '((3-2)*1)',\n", - " 5: '((3+2)*1)',\n", - " 3: '(3*(2-1))',\n", - " 2: '((3-2)+1)',\n", - " 4: '((3+2)-1)',\n", - " 9: '(3*(2+1))',\n", - " 0: '((3-2)-1)',\n", - " 0.5: '((3/2)-1)',\n", - " 2.5: '((3/2)+1)',\n", - " 7: '((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", + " 4: '((3+2)-1)', 5: '((3+2)*1)', 6: '((3+2)+1)', 7: '((3*2)+1)', 9: '(3*(2+1))'}\n", "\n", "assert splits((5, 4, 3, 2, 1)) == [\n", " ((5,), (4, 3, 2, 1)), \n", @@ -176,6 +171,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "awUDaaP4KEA7", "new_sheet": false, "run_control": { "read_only": false @@ -191,7 +187,9 @@ "execution_count": 4, "metadata": { "button": false, + "id": "ORmQCY2sKEA8", "new_sheet": false, + "outputId": "fd340dd3-57ca-4d9a-8cca-fbc203530c71", "run_control": { "read_only": false } @@ -201,8 +199,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 20.4 s, sys: 424 ms, total: 20.8 s\n", - "Wall time: 20.8 s\n" + "CPU times: user 20.1 s, sys: 514 ms, total: 20.6 s\n", + "Wall time: 20.7 s\n" ] }, { @@ -226,6 +224,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "PmeB8wYnKEA8", "new_sheet": false, "run_control": { "read_only": false @@ -238,7 +237,10 @@ { "cell_type": "code", "execution_count": 5, - "metadata": {}, + "metadata": { + "id": "8FuBcRp1KEA8", + "outputId": "7b1e4c8b-4299-48c1-a023-2b5f1340de89" + }, "outputs": [ { "data": { @@ -278,6 +280,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "Jnc1EI-jKEA9", "new_sheet": false, "run_control": { "read_only": false @@ -288,7 +291,7 @@ "\n", "Alex Bellos had another challenge: \n", "\n", - "> I was half hoping a computer scientist would let me know exactly how many distinct solutions there are with only the four basic operations. Maybe someone will. \n", + "- *I was half hoping a computer scientist would let me know exactly how many distinct solutions there are with only the four basic operations. Maybe someone will.*\n", "\n", "As it stands, my program can't answer that question, because I only keep one expression for each value. \n", "\n", @@ -302,6 +305,7 @@ "execution_count": 6, "metadata": { "button": false, + "id": "vFwgTkX5KEA9", "new_sheet": false, "run_control": { "read_only": false @@ -330,38 +334,9 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Counter({1.5: 4,\n", - " 5.0: 5,\n", - " 1.0: 5,\n", - " 6.0: 6,\n", - " 0: 2,\n", - " 9: 1,\n", - " 3.0: 2,\n", - " 4: 2,\n", - " 2: 2,\n", - " 2.5: 1,\n", - " 0.5: 1,\n", - " 7: 1})" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "expression_counts((3, 2, 1))" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, + "metadata": { + "id": "yQylOo2sKEA9" + }, "outputs": [], "source": [ "assert expression_counts((3,)) == Counter({3: 1})\n", @@ -372,6 +347,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "Ebxd9uiqKEA-", "new_sheet": false, "run_control": { "read_only": false @@ -383,10 +359,12 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": { "button": false, + "id": "7ZxGAm3BKEA-", "new_sheet": false, + "outputId": "9805792d-f64d-4301-8bbe-cac1b2379602", "run_control": { "read_only": false } @@ -398,7 +376,7 @@ "30066" ] }, - "execution_count": 9, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -411,6 +389,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "wjZxXvo3KEA-", "new_sheet": false, "run_control": { "read_only": false @@ -428,10 +407,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": { "button": false, + "id": "YdcGqKnQKEA-", "new_sheet": false, + "outputId": "afd74608-0f7f-491c-ebd9-d2ab3af4dcba", "run_control": { "read_only": false } @@ -453,7 +434,7 @@ " 2015.999999999999: '((((10*9)*(8+7))-6)/(((5-(4/3))-2)-1))'}" ] }, - "execution_count": 10, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -468,6 +449,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "63M4_WGXKEA-", "new_sheet": false, "run_control": { "read_only": false @@ -479,8 +461,11 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, + "execution_count": 10, + "metadata": { + "id": "CyTarLLEKEA-", + "outputId": "da5d0ef3-f4d5-4be5-99ee-192fe0efad6e" + }, "outputs": [ { "data": { @@ -488,7 +473,7 @@ "'Fraction(1)/(Fraction(5)-Fraction(2))'" ] }, - "execution_count": 11, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -501,8 +486,10 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": {}, + "execution_count": 11, + "metadata": { + "id": "ij0zaBmYKEA-" + }, "outputs": [], "source": [ "assert eval(exact('1/(5-2)')) == Fraction(1, 3)" @@ -510,15 +497,20 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "Irm6kO0NKEA-" + }, "source": [ "Now I can count up all the expressions in the `expression_counts(c10)` table that are near 2016, but with `exact` computation to check that the expressions evaluate to exactly 2016:" ] }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, + "execution_count": 12, + "metadata": { + "id": "V29kQB9DKEA-", + "outputId": "71a1824a-763d-4a9c-8462-beb881773d08" + }, "outputs": [ { "data": { @@ -526,7 +518,7 @@ "44499" ] }, - "execution_count": 13, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -541,6 +533,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "eYF0lV23KEA_", "new_sheet": false, "run_control": { "read_only": false @@ -552,7 +545,9 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "SfUXmDX7KEA_" + }, "source": [ "# Four 4s\n", "\n", @@ -569,8 +564,11 @@ }, { "cell_type": "code", - "execution_count": 14, - "metadata": {}, + "execution_count": 13, + "metadata": { + "id": "EtbIiPJtKEA_", + "outputId": "86fcbddb-4773-4132-e7f4-9dda388881c2" + }, "outputs": [ { "data": { @@ -587,7 +585,7 @@ " 9: '(((4/4)+4)+4)'}" ] }, - "execution_count": 14, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -598,37 +596,44 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "nVixjOMmKEA_" + }, "source": [ - "Note that I didn't do anything special to take advantage of the fact that in `(4, 4, 4, 4)` the digits are all the same. Happily, `lru_cache` does that for me automatically! If I split that into `(4, 4)` and `(4, 4)`, when it comes time to do the second half of the split, the result will already be in the cache, and so won't be recomputed." + "Note that I didn't do anything special to take advantage of the fact that in `(4, 4, 4, 4)` the digits are all the same. Happily, `@cache` does that for me automatically! If I split that into `(4, 4)` and `(4, 4)`, when it comes time to do the second half of the split, the result will already be in the cache, and so won't be recomputed." ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "Aq98pwf4KEA_" + }, "source": [ - "# New Mathematical Operations\n", + "# New Math Operations, and Permutations\n", "\n", "Bellos then writes:\n", " \n", - "> If you want to show off, you can introduce **new mathematical operations** such as powers, square roots, concatenation and decimals, ... or use the factorial symbol, `!`.\n", + "- *If you want to show off, you can introduce **new mathematical operations** such as powers, square roots, concatenation and decimals, ... or use the factorial symbol, `!`.*\n", "\n", - "Going this route there are some complications; here's how I'll handle them:\n", + "It seems there are a lot of similar puzzles that all have slightly different rules for which numbers are required and which operators are allowed. Many of the puzzles allow **permutations** of the digits: instead of requiring (2, 0, 1, 6) to appear in that order, they are allowed to appear in any order. Some allow **concatenation** of digits (e.g. the digits (1, 6) can form the expression `'16'`) and some allow **decimal points** (e.g., `'1.6'`). Some allow **unary operators** (e.g. `'√9'` or `'-(2*3)'`).\n", + "\n", + "Hanling these additional kinds of expressions introduces some issues; here's how I'll handle them:\n", "\n", "- **Imaginaries**: `√-1` is an imaginary number (I won't allow imaginary numbers).\n", "- **Irrationals**: `√2` is an irrational number (I'll use floating point approximations).\n", - "- **Round-off error**:`49*(1/49) == 0.9999999999999999`, not `1` (I'll try to round off).\n", - "- **Overflow**: `10.^(9.^8.)` gives an `OverflowError` (I'll drop overflow results).\n", - "- **Unlikely numbers**: `(9.^(4!))^(√2)` is a valid number, but unlikely to eventually lead to an integer. (I'll drop unlikely operations.)\n", - "- **Infinite unary operators**: `√√√√√√...(4!!!!!!!!...)` (I'll limit the nesting level to 2).\n", + "- **Round-off error**:`49*(1/49) == 0.9999999999999999`, not `1` (I'll try to round off, but nmight make errors of ommission or commission).\n", + "- **Overflow**: `10.^(9.^8.)` gives an `OverflowError` (I'll drop overflow results, possibly making an error of ommission).\n", + "- **Unlikely numbers**: `(.9^(4!))^(√2)` is a valid number, but unlikely to eventually lead to an integer. (I'll drop unlikely operations.)\n", + "- **Arbitraily deeply nested unary operators**: e.g, `√√√√√√√√(4!!!!!!!!)` (I'll limit the unary operator nesting level to 2).\n", "\n", "\n", - "It seems there are a lot of similar puzzles that all have slightly different rules for which numbers are required and which operators are allowed. To facilitate solving a range of puzzles with different operators, I will redefine `expressions` to take a second argument, `ops`, specifying the allowable operators as a string of one-character codes. The table below lists binary operators in the left column; unary operators in the middle; and two pseudo-operations on digits on the right:\n", + "\n", + "To facilitate solving a range of puzzles with different operators, I will redefine `expressions` to take a second argument, `ops`, specifying the allowable operators as a string of one-character codes. The table below lists binary operators in the left column; unary operators in the middle; and two pseudo-operations on digits on the right (I chose comma for concatenation, because it is familiar in numbers like: `'1,000,000'`).\n", "\n", "|Code|Operator|Code|Operator|Code|Operator|\n", "|------|--------|------|--------|----|---|\n", "|`+`|addition: 1 + 2 = 3 |`_`|unary minus: -2 = -2|`.`|decimal point: 1.23|\n", - "|`-`|subtraction: 3 - 2 = 1 |`√`|square root: √9 = 3|`&`|concatenation of digits: 123|\n", + "|`-`|subtraction: 3 - 2 = 1 |`√`|square root: √9 = 3|`,`|concatenation of digits: 123|\n", "|`*`|multiplication: 2 * 3 = 6|`!`|factorial: 4! = 24 |\n", "|`/`|division: 6 / 3 = 2 |`⌊`|floor:⌊4.4⌋ = 4|\n", "|`^`|exponentiation: 2 ^ 3 = 8|`⌈`|ceiling: ⌈4.4⌉ = 5|\n", @@ -646,8 +651,10 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": {}, + "execution_count": 14, + "metadata": { + "id": "YO8f1DE_KEA_" + }, "outputs": [], "source": [ "def true(*args): return True\n", @@ -666,7 +673,7 @@ " Operator('⌊', floor, '⌊{}⌋'),\n", " Operator('⌈', ceil, '⌈{}⌉')}}\n", "\n", - "OPS = '+-*/^_√!.&' # Default set of operators; omits floor and ceiling.\n", + "OPS = '+-*/^_√!.,' # Default set of operators; omits floor and ceiling.\n", "\n", "def operators(arity: int, ops: str) -> List[Operator]:\n", " \"\"\"All the operators in OPERATORS with given arity whose code symbol is one of `ops`.\"\"\"\n", @@ -675,15 +682,19 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "GbpkLTRLKEA_" + }, "source": [ - "I'll define the function `operate` to compute an arithmetic operation, catch any errors, and try to correct round-off errors. The idea is that since my expressions start with integers, results that are close to an integer probably are that integer. So I'll correct `(49*(1/49))` to be `1.0`. Of course, an expression like `(1+(10^-99))` is also very close to `1.0`, but it should not be rounded off. Instead, I'll try to avoid such expressions by silently dropping any intermediate value whose magnitude is outside the range of 10-10 to 1010 (except of course I will accept an exact 0)." + "I'll define the function `operate` to compute an arithmetic operation, catch any errors, and try to correct round-off errors. The idea is that since my expressions start with integers, results that are close to an integer probably are that integer. So I'll correct `(49*(1/49))` to be `1.0`. Of course, an expression like `(1+(10^-99))` is also very close to `1.0`, but it should not be equal to `1`. Instead, I'll try to avoid such expressions by silently dropping (returning `None` from `operate`) any intermediate value whose magnitude is outside the range of 10-10 to 1010 (except of course I will accept an exact 0)." ] }, { "cell_type": "code", - "execution_count": 16, - "metadata": {}, + "execution_count": 15, + "metadata": { + "id": "JvaPXzvYKEA_" + }, "outputs": [], "source": [ "def operate(operator, *args) -> Optional[float]: \n", @@ -702,24 +713,28 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "8iIQXnyCKEA_" + }, "source": [ "# Refactoring `expressions`\n", "\n", - "I'll take this opportunity to refactor `expressions` to use the new `OPERATORS`. I introduce these subfunctions:\n", - "- `digit_expressions(digits, ops)`: returns a table of expressions with just digits (and maybe a decimal place). \n", - " - If `'&'` is in `ops` allow concatenation of digits (e.g. `{44: '44'}`).\n", + "I'll take this opportunity to refactor `expressions` to use the new `OPERATORS`. I introduce three subfunctions:\n", + "- `digit_expressions(digits, ops)`: returns a table of expressions made with all the digits, in the given order.\n", + " - If `','` is in `ops` allow concatenation of digits (e.g. `{44: '44'}`).\n", " - If `'.'` is in ops allow decimals (e.g. `{4.4: '4.4', 0.44: '.44'}`. \n", - "- `add_unary_expressions(table, ops)`: add expressions like `√4` and `4!` to `table` and return `table`. \n", - "- `add_binary_expressions(table, numbers, ops)`: add expressions like `√4+4!` to `table` and return `table`.\n", + " - If `digits` is a single digit, always allow it (e.g. `{4: '4'}`).\n", + "- `add_binary_expressions(table, numbers, ops, nesting)`: builds binary expressions using all numbers in order (e.g. `{5: '(2+3)'}`).\n", + "- `add_unary_expressions(table, ops, nesting)`: add expressions like `√4` and `4!` to `table` and return `table`. \n", "\n" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 16, "metadata": { "button": false, + "id": "valCpAKPKEA_", "new_sheet": false, "run_control": { "read_only": false @@ -727,44 +742,47 @@ }, "outputs": [], "source": [ - "@lru_cache(None)\n", - "def expressions(numbers: Tuple[int], ops=OPS, nesting_level=2) -> ExpTable:\n", + "@cache\n", + "def expressions(numbers: Collection[int], ops=OPS, nesting=2, permute=False) -> ExpTable:\n", " \"Return {value: expr} for all expressions that can be made from numbers using ops.\"\n", - " table = digit_expressions(numbers, ops)\n", - " table = add_binary_expressions(table, numbers, ops)\n", - " table = add_unary_expressions(table, ops, nesting_level)\n", - " return table\n", + " orderings = (permutations(numbers) if permute else [numbers])\n", + " table = {}\n", + " for nums in orderings:\n", + " table.update(digit_expressions(nums, ops))\n", + " add_binary_expressions(table, nums, ops, nesting)\n", + " return add_unary_expressions(table, ops, nesting)\n", "\n", + "@cache\n", "def digit_expressions(digits: Tuple[int], ops: str) -> ExpTable:\n", - " \"All ways of making numbers from these digits (in order), and a decimal point.\"\n", + " \"Return {value: expr} for expressions made with all the digits, in the given order, maybe with a decimal point.\"\n", " D = ''.join(map(str, digits))\n", " table = {}\n", - " if '.' in ops: \n", - " table.update({float(d): d for d in decimals(D)})\n", - " if len(digits) == 1 or ('&' in ops and not D.startswith('0')): \n", + " if len(digits) == 1 or (',' in ops and not D.startswith('0')): \n", " table[int(D)] = D\n", + " if '.' in ops: \n", + " for L, R in splits(D, 0):\n", + " if len(L) <= 1 or not D.startswith('0'):\n", + " decimal = L + '.' + R\n", + " table[float(decimal)] = decimal\n", " return table\n", "\n", - "def decimals(digits: str)-> List[str]:\n", - " \"\"\"All ways to insert a decimal point into digits.\"\"\"\n", - " return [digits[:i] + '.' + digits[i:]\n", - " for i in range(len(digits))\n", - " if i <= 1 or not digits.startswith('0')]\n", "\n", - "def add_binary_expressions(table: ExpTable, numbers: tuple, ops: str) -> ExpTable:\n", + "def add_binary_expressions(table, numbers, ops, nesting) -> ExpTable:\n", " \"Add binary expressions by splitting numbers and combining with an op.\"\n", " binary_ops = operators(2, ops)\n", " for (Lnums, Rnums) in splits(numbers):\n", - " for (L, R) in product(expressions(Lnums, ops), expressions(Rnums, ops)):\n", - " Lexp, Rexp = '(' + expressions(Lnums, ops)[L], expressions(Rnums, ops)[R] + ')'\n", + " Ltable = expressions(Lnums, ops, nesting, False)\n", + " Rtable = expressions(Rnums, ops, nesting, False)\n", + " for (L, R) in product(Ltable, Rtable):\n", + " Lexp, Rexp = '(' + Ltable[L], Rtable[R] + ')'\n", " for op in binary_ops:\n", " assign(table, operate(op, L, R), Lexp + op.symbol + Rexp)\n", " return table\n", " \n", - "def add_unary_expressions(table: ExpTable, ops: str, nesting_level: int) -> ExpTable:\n", + "def add_unary_expressions(table, ops: str, nesting: int) -> ExpTable:\n", " \"Add unary expressions (e.g. -v, √v and v!) to table\"\n", " unary_ops = operators(1, ops)\n", - " for _ in range(nesting_level):\n", + " for _ in range(nesting):\n", " for v in tuple(table):\n", " for op in unary_ops:\n", " assign(table, operate(op, v), op.fmt.format(table[v]))\n", @@ -773,15 +791,19 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "hgPctP5mKEA_" + }, "source": [ "The function `assign` adds a `{val: exp}` entry to `table`, but if there is already an entry for `val`, it prefers the entry with the lowest total *weight*: the number of characters plus extra points for particularly complex characters. The idea is to prefer simpler expressions. If you prefer complex expressions, you can change the weights to be negative. The weights don't change how many different values can be made, they just change which of two or more expressions are chosen to represent a value." ] }, { "cell_type": "code", - "execution_count": 18, - "metadata": {}, + "execution_count": 17, + "metadata": { + "id": "AEynbSq9KEA_" + }, "outputs": [], "source": [ "def assign(table: dict, val: float, exp: str): \n", @@ -795,8 +817,30 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": 18, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{16: '16', -16: '-16'}" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "add_unary_expressions({16: '16'}, '_', 2) " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "G6lWcOR2KEA_" + }, "source": [ "That's a lot of new code; let's have some tests:" ] @@ -804,29 +848,34 @@ { "cell_type": "code", "execution_count": 19, - "metadata": {}, + "metadata": { + "id": "mJJ8AxFXKEA_" + }, "outputs": [], "source": [ "assert digit_expressions((1, 2), OPS) == {12: '12', 0.12: '.12', 1.2: '1.2'}\n", - "assert digit_expressions((0, 1, 2), OPS) == {0.012: '.012', 0.12: '0.12'}\n", - "assert digit_expressions((1, 2), '&') == {12: '12'}\n", + "assert digit_expressions((1, 2), ',') == {12: '12'}\n", + "assert digit_expressions((1, 2), '.') == {.12: '.12', 1.2: '1.2'}\n", "assert digit_expressions((1, 2), '') == {} \n", - "assert digit_expressions((1,), '') == {1: '1'}\n", - "\n", - "assert decimals('123') == ['.123', '1.23', '12.3']\n", - "assert decimals('007') == ['.007', '0.07']\n", + "assert digit_expressions((0, 1, 2), OPS) == {0.012: '.012', 0.12: '0.12'}\n", + "assert digit_expressions((0, 0, 7), '.') == {0.007: '.007', 0.07: '0.07'}\n", "\n", "assert add_unary_expressions({16: '16'}, '_', 2) == {16: '16', -16: '-16'}\n", "assert add_unary_expressions({16: '16'}, OPS, 2) == {16: '16', -16: '-16', 4: '√16', -4: '-√16', \n", " 2: '√√16', 24: '√16!'}\n", "\n", - "assert expressions((3, 2), '+-*&') == {32.0: '32', 5: '(3+2)', 1: '(3-2)', 6: '(3*2)'}" + "assert expressions((3, 2), '+-*,') == {32.0: '32', 5: '(3+2)', 1: '(3-2)', 6: '(3*2)'}\n", + "assert expressions((1,2,3), '+^') == {6:'(1+(2+3))', 1:'(1^(2+3))', 9:'(1+(2^3))', 27:'((1+2)^3)', 4:'((1^2)+3)'}\n", + "assert expressions((1,2,3), '+^', permute=True) == {1: '(1^(2+3))', 2: '(2^(1^3))', 3: '((1^3)+2)',\n", + " 4: '((1^2)+3)', 5: '((2^1)+3)', 6: '(1+(2+3))', 8: '((2^1)^3)', 9: '(1+(2^3))', 10: '(1+(3^2))',\n", + " 16: '((1+3)^2)', 27: '((1+2)^3)'}" ] }, { "cell_type": "markdown", "metadata": { "button": false, + "id": "FRTRNPuAKEBA", "new_sheet": false, "run_control": { "read_only": false @@ -841,6 +890,7 @@ "execution_count": 20, "metadata": { "button": false, + "id": "ndmqhDXnKEBA", "new_sheet": false, "run_control": { "read_only": false @@ -848,10 +898,10 @@ }, "outputs": [], "source": [ - "def show(numbers: tuple, limit=None, ops=OPS, nesting_level=2):\n", + "def show(numbers: tuple, limit=None, ops=OPS, nesting=2, permute=False):\n", " \"\"\"Print expressions for integers from 0 up to limit or the first unmakeable integer.\"\"\"\n", - " table = expressions(numbers, ops, nesting_level)\n", - " print(f'Can make 0 to {unmakeable(table)-1} with expressions({numbers}, ops=\"{ops}\").'\n", + " table = expressions(numbers, ops, nesting, permute)\n", + " print(f'Can make 0 to {unmakeable(table)-1} with expressions({numbers}, ops=\"{ops}\", permute={permute}).'\n", " f' [{len(table):,} table entries]\\n')\n", " for i in range(limit or unmakeable(table)): \n", " print('{:4} = {}'.format(i, unbracket(table[i])))\n", @@ -869,7 +919,10 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "wozlX9EmKEBA", + "tags": [] + }, "source": [ "# Four 4s with New Mathematical Operations" ] @@ -877,13 +930,16 @@ { "cell_type": "code", "execution_count": 21, - "metadata": {}, + "metadata": { + "id": "N43Lq2hKKEBA", + "outputId": "51a24d77-2e45-453b-b329-0e9f24b4efed" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 72 with expressions((4, 4, 4, 4), ops=\"+-*/^_√!.&\"). [711,642 table entries]\n", + "Can make 0 to 72 with expressions((4, 4, 4, 4), ops=\"+-*/^_√!.,\", permute=False). [711,642 table entries]\n", "\n", " 0 = 44-44\n", " 1 = 44/44\n", @@ -903,7 +959,7 @@ " 15 = 4+(44/4)\n", " 16 = .4*(44-4)\n", " 17 = (4/4)+(4*4)\n", - " 18 = .4+(.4*44)\n", + " 18 = .4+(4*4.4)\n", " 19 = 4!-(4+(4/4))\n", " 20 = 4*(4+(4/4))\n", " 21 = (4+4.4)/.4\n", @@ -958,8 +1014,8 @@ " 70 = (4!+(4^4))/4\n", " 71 = (4!+4.4)/.4\n", " 72 = 4+(4!+44)\n", - "CPU times: user 24.3 s, sys: 18.4 ms, total: 24.3 s\n", - "Wall time: 24.3 s\n" + "CPU times: user 19.7 s, sys: 71 ms, total: 19.7 s\n", + "Wall time: 19.8 s\n" ] } ], @@ -971,6 +1027,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "QJM1oLz4KEBA", "new_sheet": false, "run_control": { "read_only": false @@ -985,7 +1042,9 @@ "execution_count": 22, "metadata": { "button": false, + "id": "ZWCn9F1_KEBA", "new_sheet": false, + "outputId": "445baaed-5cf4-428c-fb23-a64d3d5f3aec", "run_control": { "read_only": false } @@ -1010,6 +1069,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "uDSx_LGeKEBA", "new_sheet": false, "run_control": { "read_only": false @@ -1018,8 +1078,20 @@ "source": [ "In a [separate video](https://www.youtube.com/embed/Noo4lN-vSvw), Alex Bellos shows how to form **every** integer from 0 to infinity using four 4s, if unlimited numbers of square root and `log` functions are allowed. The solution comes from Paul Dirac (although [Dirac originally developed it](https://nebusresearch.wordpress.com/2014/04/18/how-dirac-made-every-number/) for the \"four 2s\" problem).\n", "\n", - "Donald Knuth [conjectured](https://www.tandfonline.com/doi/abs/10.1080/0025570X.1964.11975546) that with floor, square root and factorial, you can make any positive integer with just **one** 4.\n", - "\n", + "Donald Knuth [conjectured](https://www.tandfonline.com/doi/abs/10.1080/0025570X.1964.11975546) that with floor, square root and factorial, you can make any positive integer with just **one** 4. (We would need more efficient ways of dealing with very large numbers to make progress on Knuth's problem.)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "button": false, + "id": "uDSx_LGeKEBA", + "new_sheet": false, + "run_control": { + "read_only": false + } + }, + "source": [ "Below are some popular variant problems:\n", "\n", "# Four 2s" @@ -1028,13 +1100,16 @@ { "cell_type": "code", "execution_count": 23, - "metadata": {}, + "metadata": { + "id": "e807aDInKEBA", + "outputId": "e672d88a-bc1d-456d-da6b-b720c878e939" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 30 with expressions((2, 2, 2, 2), ops=\"+-*/^_√!.&\"). [109,291 table entries]\n", + "Can make 0 to 30 with expressions((2, 2, 2, 2), ops=\"+-*/^_√!.,\", permute=False). [109,291 table entries]\n", "\n", " 0 = 22-22\n", " 1 = 22/22\n", @@ -1043,7 +1118,7 @@ " 4 = .2*(22-2)\n", " 5 = 2+(2+(2/2))\n", " 6 = (2*(2+2))-2\n", - " 7 = 2+(2/(.2*2))\n", + " 7 = 2+(2/(2*.2))\n", " 8 = 2+(2+(2+2))\n", " 9 = (22/2)-2\n", " 10 = 22/2.2\n", @@ -1076,7 +1151,9 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "_AuWPOGXKEBA" + }, "source": [ "# Four 9s" ] @@ -1084,13 +1161,16 @@ { "cell_type": "code", "execution_count": 24, - "metadata": {}, + "metadata": { + "id": "Ll4xl6TOKEBA", + "outputId": "850ea56d-da8b-4f1f-c684-ba75f1c60afb" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 61 with expressions((9, 9, 9, 9), ops=\"+-*/^_√!.&\"). [774,333 table entries]\n", + "Can make 0 to 61 with expressions((9, 9, 9, 9), ops=\"+-*/^_√!.,\", permute=False). [774,333 table entries]\n", "\n", " 0 = 99-99\n", " 1 = 99/99\n", @@ -1163,7 +1243,9 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "PfcnRnoAKEBA" + }, "source": [ "# Four 5s" ] @@ -1173,7 +1255,9 @@ "execution_count": 25, "metadata": { "button": false, + "id": "Mmed82RmKEBA", "new_sheet": false, + "outputId": "cbc51a80-8fff-43cd-fa56-390c201f3d4e", "run_control": { "read_only": false } @@ -1183,7 +1267,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 38 with expressions((5, 5, 5, 5), ops=\"+-*/^_√!.&\"). [344,933 table entries]\n", + "Can make 0 to 38 with expressions((5, 5, 5, 5), ops=\"+-*/^_√!.,\", permute=False). [344,933 table entries]\n", "\n", " 0 = 55-55\n", " 1 = 55/55\n", @@ -1193,7 +1277,7 @@ " 5 = 5+(5*(5-5))\n", " 6 = (55/5)-5\n", " 7 = 5+((5+5)/5)\n", - " 8 = 5.5+(.5*5)\n", + " 8 = 5.5+(5*.5)\n", " 9 = 5+(5-(5/5))\n", " 10 = 55/5.5\n", " 11 = 5.5+5.5\n", @@ -1207,13 +1291,13 @@ " 19 = (5!-(5*5))/5\n", " 20 = 5+(5+(5+5))\n", " 21 = (5+5.5)/.5\n", - " 22 = 55/(.5*5)\n", + " 22 = 55/(5*.5)\n", " 23 = 55-(.5^-5)\n", " 24 = (5*5)-(5/5)\n", " 25 = .5*(55-5)\n", " 26 = (5/5)+(5*5)\n", - " 27 = (.5*55)-.5\n", - " 28 = .5+(.5*55)\n", + " 27 = (5*5.5)-.5\n", + " 28 = .5+(5*5.5)\n", " 29 = (5!+(5*5))/5\n", " 30 = 55-(5*5)\n", " 31 = 55-(5!/5)\n", @@ -1224,8 +1308,8 @@ " 36 = (5!+(.5*5!))/5\n", " 37 = 5+(.5^-√(5*5))\n", " 38 = ((5!/5)-5)/.5\n", - "CPU times: user 12.2 s, sys: 16.6 ms, total: 12.2 s\n", - "Wall time: 12.2 s\n" + "CPU times: user 9.77 s, sys: 35.6 ms, total: 9.8 s\n", + "Wall time: 9.82 s\n" ] } ], @@ -1237,6 +1321,7 @@ "cell_type": "markdown", "metadata": { "button": false, + "id": "-5Qpw6s3KEBA", "new_sheet": false, "run_control": { "read_only": false @@ -1256,18 +1341,21 @@ { "cell_type": "code", "execution_count": 26, - "metadata": {}, + "metadata": { + "id": "-A_sbzTAKEBA", + "outputId": "b1e525b2-573c-42a3-f997-5ed224b069b3" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 30 with expressions((2, 0, 1, 8), ops=\"+-*/^_√!.&\"). [58,587 table entries]\n", + "Can make 0 to 30 with expressions((2, 0, 1, 8), ops=\"+-*/^_√!.,\", permute=False). [58,587 table entries]\n", "\n", - " 0 = 2*(0*18)\n", - " 1 = 2^(0*18)\n", + " 0 = 2*(.0*18)\n", + " 1 = 2^(.0*18)\n", " 2 = 20-18\n", - " 3 = 2+(0*18)!\n", + " 3 = 2.0+(1^8)\n", " 4 = 20*(1-.8)\n", " 5 = -(2.0+1)+8\n", " 6 = -2.0+(1*8)\n", @@ -1285,19 +1373,22 @@ { "cell_type": "code", "execution_count": 27, - "metadata": {}, + "metadata": { + "id": "EJ1gOa_JKEBA", + "outputId": "3025010d-78a9-48ed-8e7a-a140b0d19207" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 36 with expressions((2, 0, 1, 9), ops=\"+-*/^_√!.&\"). [80,501 table entries]\n", + "Can make 0 to 36 with expressions((2, 0, 1, 9), ops=\"+-*/^_√!.,\", permute=False). [80,501 table entries]\n", "\n", - " 0 = 2*(0*19)\n", + " 0 = 2*(.0*19)\n", " 1 = 20-19\n", - " 2 = 2+(0*19)\n", - " 3 = 2+(0*19)!\n", - " 4 = .2*(0!+19)\n", + " 2 = 20/(1+9)\n", + " 3 = 2.0+(1^9)\n", + " 4 = (-.20^-1)+9\n", " 5 = .20^(-1^9)\n", " 6 = -(2.0+1)+9\n", " 7 = -2.0+(1*9)\n", @@ -1314,24 +1405,27 @@ { "cell_type": "code", "execution_count": 28, - "metadata": {}, + "metadata": { + "id": "mZW-JHoSKEBB", + "outputId": "06a4bbb1-4f7f-4616-8ba1-92beb3fdc1ac" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 27 with expressions((2, 0, 2, 0), ops=\"+-*/^_√!.&\"). [8,845 table entries]\n", + "Can make 0 to 27 with expressions((2, 0, 2, 0), ops=\"+-*/^_√!.,\", permute=False). [8,845 table entries]\n", "\n", - " 0 = 202*0\n", + " 0 = 20-20\n", " 1 = 20/20\n", - " 2 = 2+(0*20)\n", - " 3 = 2+(.02^0)\n", - " 4 = .20*20\n", - " 5 = (2^0)/.20\n", - " 6 = 2*(0!+2.0)\n", - " 7 = 2+(0!/.20)\n", - " 8 = 2^(0!+2.0)\n", - " 9 = (20/2)-0!\n", + " 2 = 2+(.0*20)\n", + " 3 = 2+(.02^.0)\n", + " 4 = 20*.20\n", + " 5 = (2^.0)/.20\n", + " 6 = 2*(.0!+2.0)\n", + " 7 = 2+(.0!/.20)\n", + " 8 = 2^(.0!+2.0)\n", + " 9 = (20/2)-.0!\n", " 10 = 2/0.20\n" ] } @@ -1343,19 +1437,22 @@ { "cell_type": "code", "execution_count": 29, - "metadata": {}, + "metadata": { + "id": "AW_j87acKEBB", + "outputId": "e0ac8ab6-e64d-4583-9d76-82c02826e8a5" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 33 with expressions((2, 0, 2, 1), ops=\"+-*/^_√!.&\"). [40,927 table entries]\n", + "Can make 0 to 33 with expressions((2, 0, 2, 1), ops=\"+-*/^_√!.,\", permute=False). [40,927 table entries]\n", "\n", - " 0 = 2*(0*21)\n", + " 0 = 2*(.0*21)\n", " 1 = -20+21\n", - " 2 = 2+(0*21)\n", + " 2 = 2+(.0*21)\n", " 3 = 2.0+(2-1)\n", - " 4 = 2.0+(2*1)\n", + " 4 = 20*(2*.1)\n", " 5 = 2.0+(2+1)\n", " 6 = 2.0*(2+1)\n", " 7 = 2+(0.2^-1)\n", @@ -1372,22 +1469,25 @@ { "cell_type": "code", "execution_count": 30, - "metadata": {}, + "metadata": { + "id": "JD1UNX1GKEBB", + "outputId": "ed5a7bdd-fedd-43ab-b285-ab1fc5903745" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 32 with expressions((2, 0, 2, 2), ops=\"+-*/^_√!.&\"). [45,613 table entries]\n", + "Can make 0 to 32 with expressions((2, 0, 2, 2), ops=\"+-*/^_√!.,\", permute=False). [45,613 table entries]\n", "\n", - " 0 = 2*(0*22)\n", - " 1 = 2^(0*22)\n", + " 0 = 20*(2-2)\n", + " 1 = 20^(2-2)\n", " 2 = -20+22\n", " 3 = 2.0+(2/2)\n", - " 4 = 2+((0*2)+2)\n", + " 4 = -20+(2+2)!\n", " 5 = 20/(2+2)\n", " 6 = 2.0+(2+2)\n", - " 7 = 2+(0!+(2+2))\n", + " 7 = 2+(.0!+(2+2))\n", " 8 = (20/2)-2\n", " 9 = (20-2)/2\n", " 10 = 20-(2/.2)\n" @@ -1399,20 +1499,83 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": 31, "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Can make 0 to 40 with expressions((2, 0, 2, 3), ops=\"+-*/^_√!.,\", permute=False). [105,399 table entries]\n", + "\n", + " 0 = 2*(.0*23)\n", + " 1 = .20*(2+3)\n", + " 2 = 2+(.0*23)\n", + " 3 = -20+23\n", + " 4 = 20/(2+3)\n", + " 5 = .20^(2-3)\n", + " 6 = (20-2)/3\n", + " 7 = (20/2)-3\n", + " 8 = 2.0+(2*3)\n", + " 9 = ((2^.0)+2)*3\n", + " 10 = 2.0*(2+3)\n" + ] + } + ], + "source": [ + "show((2,0,2,3), 11)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PPs4y4mxKEBB" + }, "source": [ "# Can you make 24?\n", "\n", - "In the [538 Riddler for July 10th 2020](https://fivethirtyeight.com/features/can-you-make-24/), Zach Wissner-Gross asks \"Can you make 24?\" from the digits (2, 3, 3, 4), **in any order**, with just the five binary operators. For extra credit, Zach asks for multiple ways to make 24. \n", - "\n", - "We haven't dealt with reporting multiple ways, nor with allowing the digits to change their order. I'll deal with both by trying all permutations of the digits, and collecting one expression from each permutation (if there is one). If there are multiple ways with a single permutation we won't get more than one of those, but this approach should be good enough to answer Zach's question." + "In the [538 Riddler for July 10th 2020](https://fivethirtyeight.com/features/can-you-make-24/), Zach Wissner-Gross asks \"Can you make 24?\" from the digits (2, 3, 3, 4), **in any order**, with just the five binary operators. " ] }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 32, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'(((3^2)-3)*4)'" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "expressions((2, 3, 3, 4), '+-*/^', permute=True)[24]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PPs4y4mxKEBB" + }, + "source": [ + "For extra credit, Zach asks for multiple ways to make 24. \n", + "\n", + "We haven't dealt with reporting multiple ways to make a number; the `ExpTable` only keeps one. I'll try collecting one expression from each permutation of the numbers. If there are multiple ways with a single permutation we won't keep more than one of those, but this approach should be good enough to answer Zach's question." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "id": "dLZMMnH-KEBB", + "outputId": "9e964cef-f10d-49fd-faf6-bc171de07344" + }, "outputs": [ { "data": { @@ -1425,32 +1588,37 @@ " '(4*((3^2)-3))'}" ] }, - "execution_count": 31, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "def can_make(total: int, numbers: tuple, ops=OPS) -> Set[Exp]:\n", + "def can_make(total: int, numbers: tuple, ops='+-*/^') -> Set[Exp]:\n", " \"\"\"Can we make the total from the numbers (in any order)? Return a set of expressions.\"\"\"\n", " return {expressions(nums, ops)[total]\n", - " for nums in set(permutations(numbers)) \n", + " for nums in set(permutations(numbers))\n", " if total in expressions(nums, ops)}\n", "\n", - "can_make(24, (2, 3, 3, 4), '+-*/^')" + "can_make(24, (2, 3, 3, 4))" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "sNnNDjCvKEBB" + }, "source": [ "Readers suggested other interesting tuples of digits:" ] }, { "cell_type": "code", - "execution_count": 32, - "metadata": {}, + "execution_count": 34, + "metadata": { + "id": "snhb7k8OKEBB", + "outputId": "44f3cf49-aa56-4900-f510-3eedb4970307" + }, "outputs": [ { "data": { @@ -1468,19 +1636,22 @@ " '(8*(8-(3+2)))'}" ] }, - "execution_count": 32, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "can_make(24, (2, 3, 8, 8), '+-*/^')" + "can_make(24, (2, 3, 8, 8))" ] }, { "cell_type": "code", - "execution_count": 33, - "metadata": {}, + "execution_count": 35, + "metadata": { + "id": "gia8RdaUKEBB", + "outputId": "46852452-3ebd-4718-ad7a-52d4fc6de9bf" + }, "outputs": [ { "data": { @@ -1494,19 +1665,22 @@ " '(10-(2*(3-10)))'}" ] }, - "execution_count": 33, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "can_make(24, (2, 3, 10, 10), '+-*/^')" + "can_make(24, (2, 3, 10, 10))" ] }, { "cell_type": "code", - "execution_count": 34, - "metadata": {}, + "execution_count": 36, + "metadata": { + "id": "VhhMQ33sKEBB", + "outputId": "66fe6857-f940-409b-aa2a-04fdb00e064e" + }, "outputs": [ { "data": { @@ -1514,19 +1688,22 @@ "{'(8/(3-(8/3)))'}" ] }, - "execution_count": 34, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "can_make(24, (3, 3, 8, 8), '+-*/^')" + "can_make(24, (3, 3, 8, 8))" ] }, { "cell_type": "code", - "execution_count": 35, - "metadata": {}, + "execution_count": 37, + "metadata": { + "id": "nbcNqMdFKEBB", + "outputId": "e3d17354-e297-4ded-9193-5fe615902072" + }, "outputs": [ { "data": { @@ -1545,19 +1722,22 @@ " '(6+(2*(6+3)))'}" ] }, - "execution_count": 35, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "can_make(24, (2, 3, 6, 6), '+-*/^')" + "can_make(24, (2, 3, 6, 6))" ] }, { "cell_type": "code", - "execution_count": 36, - "metadata": {}, + "execution_count": 38, + "metadata": { + "id": "L8SAsmSrKEBB", + "outputId": "33874782-4dcd-460e-dfaf-140fe71bf502" + }, "outputs": [ { "data": { @@ -1565,18 +1745,20 @@ "{'((5^2)-(0^0))'}" ] }, - "execution_count": 36, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "can_make(24, (0, 0, 2, 5), '+-*/^')" + "can_make(24, (0, 0, 2, 5))" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "77JudWtrKEBB" + }, "source": [ "This relies on 00 = 1, which Python agrees with, but many mathematicians would say is undefined.\n", "\n", @@ -1585,8 +1767,11 @@ }, { "cell_type": "code", - "execution_count": 37, - "metadata": {}, + "execution_count": 39, + "metadata": { + "id": "VDlW5eWVKEBB", + "outputId": "d2d3e78c-485f-407a-8888-579ba423f1d2" + }, "outputs": [ { "data": { @@ -1594,7 +1779,7 @@ "{'(10-(6/(13-11))!)!'}" ] }, - "execution_count": 37, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -1605,8 +1790,11 @@ }, { "cell_type": "code", - "execution_count": 38, - "metadata": {}, + "execution_count": 40, + "metadata": { + "id": "5GYEEXhnKEBB", + "outputId": "bdee3db6-f560-4b4f-ba2a-036b4d8ee1b3" + }, "outputs": [ { "data": { @@ -1614,7 +1802,7 @@ "{'(8/((1^9)+1))!', '(8/(1+(1^9)))!'}" ] }, - "execution_count": 38, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1625,8 +1813,11 @@ }, { "cell_type": "code", - "execution_count": 39, - "metadata": {}, + "execution_count": 41, + "metadata": { + "id": "pqZLLXXCKEBB", + "outputId": "97da7ef1-2033-45d0-f636-1ea7bc14d126" + }, "outputs": [ { "data": { @@ -1634,7 +1825,7 @@ "{'(9!/(7!+(7!+7!)))'}" ] }, - "execution_count": 39, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1645,65 +1836,76 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "pdDW9gGHKEBB" + }, "source": [ "# Making 6 from 3 Digits\n", "\n", "Another Facebook \"omg math\" problem:\n", "\n", - "> For each digit from 0 to 9, find at least one way to express 6 using only that digit exactly three times and arithmetic operations. For instance, using the digit 2, `'2+2^2'` = 6.\n", + " *For each digit, find a way to express 6 using only that digit exactly three times and arithmetic operations. E.g., for the digit 2, `'2+2^2'` = 6.*\n", "\n", "This is easy if \"arithmetic operations\" include square root and factorial:" ] }, { "cell_type": "code", - "execution_count": 40, - "metadata": {}, + "execution_count": 42, + "metadata": { + "id": "CoKnbYBxKEBB", + "outputId": "dd72b838-7b22-4080-9b29-739585881ce7" + }, "outputs": [ { "data": { "text/plain": [ - "['(0!+(0!+0!))!',\n", - " '(1+(1+1))!',\n", - " '(2+(2+2))',\n", - " '((3*3)-3)',\n", - " '(4-(4/4))!',\n", - " '(5+(5/5))',\n", - " '(6+(6-6))',\n", - " '(7-(7/7))',\n", - " '√(8+(8/8))!',\n", - " '((9+9)/√9)']" + "{'(0!+(0!+0!))!': 6,\n", + " '(1+(1+1))!': 6,\n", + " '(2+(2+2))': 6,\n", + " '((3*3)-3)': 6,\n", + " '(4-(4/4))!': 6,\n", + " '(5+(5/5))': 6,\n", + " '(6+(6-6))': 6,\n", + " '(7-(7/7))': 6,\n", + " '√(8+(8/8))!': 6,\n", + " '((9+9)/√9)': 6}" ] }, - "execution_count": 40, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "[expressions((n, n, n), '+-*/^!√').get(6) for n in range(10)]" + "{expressions((n, n, n), '+-*/^!√').get(6): 6 for n in range(10)}" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "eFFOUF7EKEBB", + "tags": [] + }, "source": [ "# Even More Fours: The Power of Floor and Ceiling\n", "\n", - "With the standard set of `OPS`, we got all the integers up to 72 with four 4s. If we add the floor and ceiling operators, we get a big jump: suddenly, all the results of a division or a square root that didn't form an integer can now be coerced into integers. Instead of getting the integers only up to 72, we now get all the way up to 1644 (although it takes three times as long to get there):" + "With the standard set of `OPS`, we got all the integers up to 72 with four 4s. If we add the floor and ceiling operators, we get a big jump: suddenly, all the results of a division or a square root that didn't form an integer can now be coerced into integers. Instead of getting the integers only up to 72, we now get all the way up to 1644 (although it takes a full minute to get there, and I'll just show the first 100, to sace space):" ] }, { "cell_type": "code", - "execution_count": 41, - "metadata": {}, + "execution_count": 43, + "metadata": { + "id": "jbJsFkNZKEBC", + "outputId": "fea9ae24-2e75-4a11-8098-162790f91625" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 1644 with expressions((4, 4, 4, 4), ops=\"+-*/^_√!.&⌊⌈\"). [1,184,901 table entries]\n", + "Can make 0 to 1644 with expressions((4, 4, 4, 4), ops=\"+-*/^_√!.,⌊⌈\", permute=False). [1,184,901 table entries]\n", "\n", " 0 = 44-44\n", " 1 = 44/44\n", @@ -1723,8 +1925,8 @@ " 15 = 4+(44/4)\n", " 16 = .4*(44-4)\n", " 17 = (4/4)+(4*4)\n", - " 18 = .4+(.4*44)\n", - " 19 = ⌊(.44*44)⌋\n", + " 18 = .4+(4*4.4)\n", + " 19 = ⌊(44*.44)⌋\n", " 20 = 4*(4+(4/4))\n", " 21 = (4+4.4)/.4\n", " 22 = √4*(44/4)\n", @@ -1805,1585 +2007,46 @@ " 97 = (4/4)+(4*4!)\n", " 98 = .4+(4*(.4+4!))\n", " 99 = ⌈(.4*(4^4))⌉-4\n", - " 100 = 44/.44\n", - " 101 = ⌈4.4⌉+(4*4!)\n", - " 102 = (.4*(4^4))-.4\n", - " 103 = ⌊(4.4*(4!-.4))⌋\n", - " 104 = 44+(4!/.4)\n", - " 105 = (44-√4)/.4\n", - " 106 = (44/.4)-4\n", - " 107 = ⌈(4!*4.44)⌉\n", - " 108 = (4*(4+4!))-4\n", - " 109 = (44-.4)/.4\n", - " 110 = ⌊44.4⌋/.4\n", - " 111 = 444/4\n", - " 112 = (4*4)+(4*4!)\n", - " 113 = ⌈(.44*(4^4))⌉\n", - " 114 = 4+(44/.4)\n", - " 115 = (√4+44)/.4\n", - " 116 = 4+(4*(4+4!))\n", - " 117 = ⌈(4!^(.4^-.44))⌉\n", - " 118 = (4+(4/4))!-√4\n", - " 119 = ⌈4.4⌉!-(4/4)\n", - " 120 = (4+44)/.4\n", - " 121 = (44/4)^√4\n", - " 122 = √4+(4+(4/4))!\n", - " 123 = ⌊(4.4*(4+4!))⌋\n", - " 124 = 4+(4+(4/4))!\n", - " 125 = (4!-4)/(.4*.4)\n", - " 126 = ((4^4)-4)/√4\n", - " 127 = ((4^4)-√4)/√4\n", - " 128 = 4*(4*(4+4))\n", - " 129 = (√4+(4^4))/√4\n", - " 130 = (4+(4^4))/√4\n", - " 131 = ⌈(4!*(4!/4.4))⌉\n", - " 132 = 44*(4-⌈.4⌉)\n", - " 133 = ⌈((4!-4)*√44)⌉\n", - " 134 = 4!+(44/.4)\n", - " 135 = ⌊(4!/.44)⌋/.4\n", - " 136 = √4*(4!+44)\n", - " 137 = ⌈(4!/(.4*.44))⌉\n", - " 138 = ((4!*4!)-4!)/4\n", - " 139 = ⌊(4^(4-.44))⌋\n", - " 140 = 44+(4*4!)\n", - " 141 = ⌈(4*((.4^-4)-4))⌉\n", - " 142 = (4!*(4!/4))-√4\n", - " 143 = ((4!*4!)-4)/4\n", - " 144 = 4!*((4/.4)-4)\n", - " 145 = (4+(4!*4!))/4\n", - " 146 = (4!/(.4*.4))-4\n", - " 147 = ⌊((4^4)/(4^.4))⌋\n", - " 148 = 4+(4!*(4!/4))\n", - " 149 = ⌊(.4*(4.4^4))⌋\n", - " 150 = .4*⌈(4.4^4)⌉\n", - " 151 = (.4+(4!/.4))/.4\n", - " 152 = (4*44)-4!\n", - " 153 = ⌈(4/(.4^4))⌉-4\n", - " 154 = 4+(4!/(.4*.4))\n", - " 155 = ⌊(4!*√44)⌋-4\n", - " 156 = (4*4!)+(4!/.4)\n", - " 157 = ⌈(44*(4!^.4))⌉\n", - " 158 = ⌊(44*(4-.4))⌋\n", - " 159 = ⌈(44*(4-.4))⌉\n", - " 160 = 4*(44-4)\n", - " 161 = ⌈((4-.44)^4)⌉\n", - " 162 = ⌈((.4+4!)*√44)⌉\n", - " 163 = ⌊((.4-4)^4)⌋-4\n", - " 164 = 44+⌈4.4⌉!\n", - " 165 = 4+⌊(4!^(.4*4))⌋\n", - " 166 = ⌊(4!*√(4+44))⌋\n", - " 167 = ⌈(4!*√(4+44))⌉\n", - " 168 = 4*(44-√4)\n", - " 169 = ⌈(.4+((.4-4)^4))⌉\n", - " 170 = (4!+44)/.4\n", - " 171 = ⌊(4.4/(.4^4))⌋\n", - " 172 = (4*44)-4\n", - " 173 = ⌈(4*(4+(.4^-4)))⌉\n", - " 174 = (4*44)-√4\n", - " 175 = (4*44)-⌈.4⌉\n", - " 176 = 44*√(4*4)\n", - " 177 = ⌊(.4*444)⌋\n", - " 178 = √4+(4*44)\n", - " 179 = ((4!/4)!-4)/4\n", - " 180 = 4+(4*44)\n", - " 181 = (4+(4!/4)!)/4\n", - " 182 = √4+((4!/4)!/4)\n", - " 183 = ⌈(4!*(4+(4-.4)))⌉\n", - " 184 = 4*(√4+44)\n", - " 185 = ⌊((4+4!)*√44)⌋\n", - " 186 = (4!+(4!/4)!)/4\n", - " 187 = ⌊(4.4^4)⌋/√4\n", - " 188 = (4!*(4+4))-4\n", - " 189 = ⌈((4+4)*(4!-.4))⌉\n", - " 190 = (4!*(4+4))-√4\n", - " 191 = (4!*(4+4))-⌈.4⌉\n", - " 192 = 4*(4+44)\n", - " 193 = ⌊(4.4*44)⌋\n", - " 194 = ⌈(4.4*44)⌉\n", - " 195 = ⌊((.4+4!)*(4+4))⌋\n", - " 196 = 4+(4!*(4+4))\n", - " 197 = ⌈(44*√(4!-4))⌉\n", - " 198 = ⌈(44*(√4!-.4))⌉\n", - " 199 = ⌊(44^(.4+⌈.4⌉))⌋\n", - " 200 = 4!+(4*44)\n", - " 201 = ⌊(4!*(4+4.4))⌋\n", - " 202 = ⌈(4!*(4+4.4))⌉\n", - " 203 = ⌊(44*(4+√.4))⌋\n", - " 204 = 4!+((4!/4)!/4)\n", - " 205 = ⌈((.4+.4)*(4^4))⌉\n", - " 206 = ⌈(4^(4-(.4*.4)))⌉\n", - " 207 = ⌊(4.4^(4-.4))⌋\n", - " 208 = 4*(4+(4!+4!))\n", - " 209 = ⌊((4-√.4)^4.4)⌋\n", - " 210 = ((4+4!)/4)!/4!\n", - " 211 = ⌊(4.4*(4!+4!))⌋\n", - " 212 = (4^4)-44\n", - " 213 = ⌊(44.4^√√4)⌋\n", - " 214 = ⌈(44.4^√√4)⌉\n", - " 215 = ⌊((4-(4/4!))^4)⌋\n", - " 216 = 4!+(4!*(4+4))\n", - " 217 = ⌊(√4!*44.4)⌋\n", - " 218 = ⌊(4*(4!/.44))⌋\n", - " 219 = ⌈(4*(4!/.44))⌉\n", - " 220 = 44*⌈4.4⌉\n", - " 221 = ⌈(4!*(4^(.4*4)))⌉\n", - " 222 = 444/√4\n", - " 223 = ⌈(4^(4-(.4/4)))⌉\n", - " 224 = (4+4)*(4+4!)\n", - " 225 = ⌊(4/(.4^4.4))⌋\n", - " 226 = ⌈(4/(.4^4.4))⌉\n", - " 227 = ⌈(.4*(4!*4!))⌉-4\n", - " 228 = (4^4)-(4+4!)\n", - " 229 = ⌈(.4*((4!*4!)-4))⌉\n", - " 230 = ((4*4!)-4)/.4\n", - " 231 = ⌊(.44^-√44)⌋\n", - " 232 = .4*(4+(4!*4!))\n", - " 233 = ⌈(44*√(4+4!))⌉\n", - " 234 = √4+((4^4)-4!)\n", - " 235 = ((4*4!)-√4)/.4\n", - " 236 = 4+((4^4)-4!)\n", - " 237 = ⌊(√.4*(4.4^4))⌋\n", - " 238 = (4*(4!/.4))-√4\n", - " 239 = ((4*4!)-.4)/.4\n", - " 240 = (4^4)-(4*4)\n", - " 241 = (.4+(4*4!))/.4\n", - " 242 = √4+(4*(4!/.4))\n", - " 243 = ⌊((.4-(4*4))^√4)⌋\n", - " 244 = 4+(4*(4!/.4))\n", - " 245 = (√4+(4*4!))/.4\n", - " 246 = (4^4)-(4/.4)\n", - " 247 = ⌊(4^(4-(.4^4)))⌋\n", - " 248 = (4^4)-(4+4)\n", - " 249 = (4^4)-⌈√44⌉\n", - " 250 = (4^4)-(4!/4)\n", - " 251 = (4^4)-⌈4.4⌉\n", - " 252 = (4^4)-√(4*4)\n", - " 253 = ⌈.4⌉+((4^4)-4)\n", - " 254 = √4+((4^4)-4)\n", - " 255 = (4^4)-(4/4)\n", - " 256 = 4*(4*(4*4))\n", - " 257 = (4/4)+(4^4)\n", - " 258 = 4+((4^4)-√4)\n", - " 259 = 4+((4^4)-⌈.4⌉)\n", - " 260 = 4+(4^√(4*4))\n", - " 261 = (4^4)+⌈4.4⌉\n", - " 262 = (4^4)+(4!/4)\n", - " 263 = (4^4)+⌈√44⌉\n", - " 264 = 4!*(44/4)\n", - " 265 = ⌊(4^(4+(.4^4)))⌋\n", - " 266 = (4/.4)+(4^4)\n", - " 267 = ⌊(.4^((.4+4!)/-4))⌋\n", - " 268 = (4^4)+(4!/√4)\n", - " 269 = ⌈(4!^(4*.44))⌉\n", - " 270 = ⌊((4*(.4-√√4))^4)⌋\n", - " 271 = ⌊(4*(4!*√(4+4)))⌋\n", - " 272 = 4*(4!+44)\n", - " 273 = ⌊(4^(4!^.44))⌋\n", - " 274 = ⌈(4^(4!^.44))⌉\n", - " 275 = 44/(.4*.4)\n", - " 276 = 4!+((4^4)-4)\n", - " 277 = 4!+⌈(4!^(4^.4))⌉\n", - " 278 = 4!+((4^4)-√4)\n", - " 279 = ⌈(4*(44/√.4))⌉\n", - " 280 = 4*((4+4!)/.4)\n", - " 281 = ⌈(√.4*444)⌉\n", - " 282 = 4!+(√4+(4^4))\n", - " 283 = ⌈((4+(.4/4))^4)⌉\n", - " 284 = 4+(4!+(4^4))\n", - " 285 = ⌈((4^4)/(√4!-4))⌉\n", - " 286 = ((4!*4!)-4)/√4\n", - " 287 = ⌈(√4!^(4-.44))⌉\n", - " 288 = 4!*(4+(4+4))\n", - " 289 = ⌊(.4*44)⌋^√4\n", - " 290 = (4+(4!*4!))/√4\n", - " 291 = ⌊(44*√44)⌋\n", - " 292 = ⌈(44*√44)⌉\n", - " 293 = (4^4)+⌊(4!/√.4)⌋\n", - " 294 = ⌊(4^(4+(.4/4)))⌋\n", - " 295 = ⌈(4^(4+(.4/4)))⌉\n", - " 296 = (⌈4.4⌉!/.4)-4\n", - " 297 = ⌊(.4*(4!+(4!/4)!))⌋\n", - " 298 = ⌊((4+(√.4/4))^4)⌋\n", - " 299 = ⌊((4+(.4*.4))^4)⌋\n", - " 300 = 44+(4^4)\n", - " 301 = ⌊((4+(4/4!))^4)⌋\n", - " 302 = ⌈((4+(4/4!))^4)⌉\n", - " 303 = ⌈(.4^(.4-√44))⌉\n", - " 304 = 4!+(4!+(4^4))\n", - " 305 = ⌈(44*√(4!+4!))⌉\n", - " 306 = ⌊(4^(4*(.4+√.4)))⌋\n", - " 307 = ⌈(4^(4*(.4+√.4)))⌉\n", - " 308 = 44*⌈√44⌉\n", - " 309 = ⌊((.4*44)^√4)⌋\n", - " 310 = (4+⌈4.4⌉!)/.4\n", - " 311 = ⌊((4+(.4/√4))^4)⌋\n", - " 312 = ⌊((4+4)/(.4^4))⌋\n", - " 313 = ⌈((4+4)/(.4^4))⌉\n", - " 314 = ⌈(444/√√4)⌉\n", - " 315 = ⌈√44⌉!/(4*4)\n", - " 316 = (4^4)+(4!/.4)\n", - " 317 = ⌈(.44*(4!/4)!)⌉\n", - " 318 = ⌊(4!*√(4*44))⌋\n", - " 319 = ⌊(4^(4+(.4*.4)))⌋\n", - " 320 = 4*(4*(4!-4))\n", - " 321 = ⌈(4*(4^√(4/.4)))⌉\n", - " 322 = ⌊(4^(4+(4/4!)))⌋\n", - " 323 = ⌈(4^(4+(4/4!)))⌉\n", - " 324 = ((4!/4)^4)/4\n", - " 325 = ⌈(.4^(4/-√.4))⌉-4\n", - " 326 = ⌊(4!*(4+(.4*4!)))⌋\n", - " 327 = ⌈(4!*(4+(.4*4!)))⌉\n", - " 328 = ⌊(.4^-√(44-4))⌋\n", - " 329 = ⌈(.4^-√(44-4))⌉\n", - " 330 = ⌊((4+4!)^(4^.4))⌋\n", - " 331 = ⌈((4+4!)^(4^.4))⌉\n", - " 332 = ⌊((.4+√4)^√44)⌋\n", - " 333 = ⌊(√4!*(4!+44))⌋\n", - " 334 = ⌈(√4!*(4!+44))⌉\n", - " 335 = ⌊(√4*((.4-4)^4))⌋\n", - " 336 = 4!*(4+(4/.4))\n", - " 337 = ⌊(√4^(4+4.4))⌋\n", - " 338 = ⌈(√4^(4+4.4))⌉\n", - " 339 = ⌊(4!^(44/4!))⌋\n", - " 340 = ⌈(4!^(44/4!))⌉\n", - " 341 = ⌈(44*√(4!/.4))⌉\n", - " 342 = ⌊(4*(4!*(4!^.4)))⌋\n", - " 343 = ⌈(4*(4!*(4!^.4)))⌉\n", - " 344 = 4*⌊(4!*(4-.4))⌋\n", - " 345 = ⌊(4*(4!*(4-.4)))⌋\n", - " 346 = ⌊(4!^(4^.44))⌋\n", - " 347 = ⌈(4!^(4^.44))⌉\n", - " 348 = 4*⌈(4!*(4-.4))⌉\n", - " 349 = ⌊(4!^(.4+(.4^-.4)))⌋\n", - " 350 = ⌊(4.4^4)⌋-4!\n", - " 351 = ⌈(4.4^4)⌉-4!\n", - " 352 = 44*(4+4)\n", - " 353 = ⌈(.4^(.4*(4*-4)))⌉\n", - " 354 = ⌊((4.4^√4!)/4)⌋\n", - " 355 = ⌈(4.4^√4!)⌉/4\n", - " 356 = ((4!/4)!/√4)-4\n", - " 357 = ⌊(.4*(4+(4^√4!)))⌋\n", - " 358 = ((4!/4)!-4)/√4\n", - " 359 = ⌈((4+4)^√(4+4))⌉\n", - " 360 = (4*(4*4!))-4!\n", - " 361 = (⌈4.4⌉-4!)^√4\n", - " 362 = (4+(4!/4)!)/√4\n", - " 363 = ⌊(4^(4+(.4*√.4)))⌋\n", - " 364 = 4+((4!/4)!/√4)\n", - " 365 = ⌈(4*((4*4!)-√4!))⌉\n", - " 366 = 4+⌊(√√4*(4^4))⌋\n", - " 367 = ⌊((4^(4-.4))/.4)⌋\n", - " 368 = 4*((4*4!)-4)\n", - " 369 = ⌊((4^4)/(.4^.4))⌋\n", - " 370 = ⌊(4.4^4)⌋-4\n", - " 371 = ⌈(4.4^4)⌉-4\n", - " 372 = ⌊(4.4^4)⌋-√4\n", - " 373 = ⌈(4.4^4)⌉-√4\n", - " 374 = ⌊((4.4^4)-.4)⌋\n", - " 375 = .4*(4!/(.4^4))\n", - " 376 = 4*((4*4!)-√4)\n", - " 377 = √4+⌈(4.4^4)⌉\n", - " 378 = 4+⌊(4.4^4)⌋\n", - " 379 = 4+⌈(4.4^4)⌉\n", - " 380 = (4*(4*4!))-4\n", - " 381 = ⌊((.4^-(4+4))/4)⌋\n", - " 382 = (4*(4*4!))-√4\n", - " 383 = (4*(4*4!))-⌈.4⌉\n", - " 384 = (4+4)*(4!+4!)\n", - " 385 = ⌈.4⌉+(4*(4*4!))\n", - " 386 = √4+(4*(4*4!))\n", - " 387 = ⌈(4*(√.4+(4*4!)))⌉\n", - " 388 = 4+(4*(4*4!))\n", - " 389 = ⌈(4.44^4)⌉\n", - " 390 = ⌊(4*(4*(.4+4!)))⌋\n", - " 391 = ⌈(4*(4*(.4+4!)))⌉\n", - " 392 = 4*(√4+(4*4!))\n", - " 393 = ⌊(4!*(.4+(4*4)))⌋\n", - " 394 = ⌈(4!*(.4+(4*4)))⌉\n", - " 395 = ⌊((√4!-.44)^4)⌋\n", - " 396 = 44*⌊(.4*4!)⌋\n", - " 397 = ⌊(4!*(√44/.4))⌋\n", - " 398 = 4!+⌊(4.4^4)⌋\n", - " 399 = 4!+⌈(4.4^4)⌉\n", - " 400 = 4*(4+(4*4!))\n", - " 401 = ⌈((4^4)/√.4)⌉-4\n", - " 402 = √4+((4-4!)^√4)\n", - " 403 = ⌊((4!^(.4*4))/.4)⌋\n", - " 404 = 4+((4-4!)^√4)\n", - " 405 = ⌊(.4^-((.4*4)^4))⌋\n", - " 406 = ⌈(.4^-((.4*4)^4))⌉\n", - " 407 = ⌈(4*(4*(4!+√√4)))⌉\n", - " 408 = 4!+(4*(4*4!))\n", - " 409 = ⌊(.4*(4*(4^4)))⌋\n", - " 410 = ⌈(.4*(4*(4^4)))⌉\n", - " 411 = ⌈((4+(√4/4))^4)⌉\n", - " 412 = 4*⌈(.4*(4^4))⌉\n", - " 413 = ⌈(.4^-√44)⌉-4!\n", - " 414 = ⌈((4!/4)!/(4^.4))⌉\n", - " 415 = ⌊((4!^√(4-.4))-.4)⌋\n", - " 416 = 4*(4*(4!+√4))\n", - " 417 = ⌊(4^((4^.4)/.4))⌋\n", - " 418 = ⌈(4^((4^.4)/.4))⌉\n", - " 419 = ⌊(((.4-4)^4)/.4)⌋\n", - " 420 = 444-4!\n", - " 421 = ⌊(4^4.4)⌋-4!\n", - " 422 = ⌊(.4*(4!*44))⌋\n", - " 423 = ⌈(.4*(4!*44))⌉\n", - " 424 = 4*⌈(4!*4.4)⌉\n", - " 425 = ⌈(.4^-√(44-.4))⌉\n", - " 426 = ⌊(44^(.4*4))⌋\n", - " 427 = ⌈(44^(.4*4))⌉\n", - " 428 = 4*⌈(4^(4-√.4))⌉\n", - " 429 = ⌊(4*(4!*√(4!-4)))⌋\n", - " 430 = √4*⌊(√4!*44)⌋\n", - " 431 = ⌊(44*√(4*4!))⌋\n", - " 432 = 4!*(√4+(4*4))\n", - " 433 = ⌈(.4^-√44)⌉-4\n", - " 434 = ⌊(.4^-√44)⌋-√4\n", - " 435 = ⌊((.4^-√44)-.4)⌋\n", - " 436 = ⌊(.4+(.4^-√44))⌋\n", - " 437 = ⌊((4+(4^-.4))^4)⌋\n", - " 438 = ⌈((4+(4^-.4))^4)⌉\n", - " 439 = ⌊(444-√4!)⌋\n", - " 440 = 444-4\n", - " 441 = ⌊(4^4.4)⌋-4\n", - " 442 = 444-√4\n", - " 443 = 444-⌈.4⌉\n", - " 444 = ⌊444.4⌋\n", - " 445 = ⌈444.4⌉\n", - " 446 = √4+444\n", - " 447 = ⌈(.4+(4^4.4))⌉\n", - " 448 = 4+444\n", - " 449 = 4+⌊(4^4.4)⌋\n", - " 450 = 4+⌈(4^4.4)⌉\n", - " 451 = ⌈(√4!+(4^4.4))⌉\n", - " 452 = 4*(⌊(4!*√4!)⌋-4)\n", - " 453 = ⌈((4^4)/(.4*√√4))⌉\n", - " 454 = ⌊(4*((4!*√4!)-4))⌋\n", - " 455 = ⌊(4^(4+(4^-√.4)))⌋\n", - " 456 = (4!*(4!-4))-4!\n", - " 457 = ⌈((4+√.4)^4)⌉-4\n", - " 458 = ⌈((4^4)/(.4^√.4))⌉\n", - " 459 = ⌈(.44^-(4!^√.4))⌉\n", - " 460 = ⌊((√4-√44)^4)⌋\n", - " 461 = ⌈((√4-√44)^4)⌉\n", - " 462 = ⌊(4*(4*(4!+√4!)))⌋\n", - " 463 = ⌈(4*(4*(4!+√4!)))⌉\n", - " 464 = (4!/4)!-(4^4)\n", - " 465 = 4+⌈((4+√.4)^4)⌉\n", - " 466 = ⌊(4*(4!*√4!))⌋-4\n", - " 467 = ⌈(4*(4!*√4!))⌉-4\n", - " 468 = 4!+444\n", - " 469 = 4!+⌊(4^4.4)⌋\n", - " 470 = 4!+⌈(4^4.4)⌉\n", - " 471 = ⌊(4^4.44)⌋\n", - " 472 = ⌈(4^4.44)⌉\n", - " 473 = ⌈(√4!*(.4+(4*4!)))⌉\n", - " 474 = 4+⌊(4*(4!*√4!))⌋\n", - " 475 = 4+⌈(4*(4!*√4!))⌉\n", - " 476 = (4!*(4!-4))-4\n", - " 477 = ⌊(4^(4/(√4!-4)))⌋\n", - " 478 = (4!*(4!-4))-√4\n", - " 479 = (4!*(4!-4))-⌈.4⌉\n", - " 480 = 4!*(4+(4*4))\n", - " 481 = ⌈.4⌉+(4!*(4!-4))\n", - " 482 = √4+(4!*(4!-4))\n", - " 483 = ⌊(4^(√4!-.44))⌋\n", - " 484 = (44^√4)/4\n", - " 485 = ⌊((4+(.4^.4))^4)⌋\n", - " 486 = ⌈((4+(.4^.4))^4)⌉\n", - " 487 = ⌈(4*(4+(4!*√4!)))⌉\n", - " 488 = (.4+4!)*(4!-4)\n", - " 489 = ⌊(4!*(.4+(4!-4)))⌋\n", - " 490 = ⌈(4!*(.4+(4!-4)))⌉\n", - " 491 = ⌈((4+√(√4/4))^4)⌉\n", - " 492 = ⌊(4^√(4+(4*4)))⌋\n", - " 493 = ⌈(4^√(4+(4*4)))⌉\n", - " 494 = 4!+⌊(4*(4!*√4!))⌋\n", - " 495 = ⌊((4!-(4^.4))^√4)⌋\n", - " 496 = 4*(4+⌈4.4⌉!)\n", - " 497 = 4+⌈(4^√(4!-4))⌉\n", - " 498 = ⌊((4/√.4)^(4-√.4))⌋\n", - " 499 = ⌊(.4^-√(√4+44))⌋\n", - " 500 = (⌈.4⌉+4!)*(4!-4)\n", - " 501 = ⌊(.4*(√4!*(4^4)))⌋\n", - " 502 = ⌊((4-.44)^√4!)⌋\n", - " 503 = ⌈((4-.44)^√4!)⌉\n", - " 504 = √4*((4^4)-4)\n", - " 505 = ⌊(√4^(44/√4!))⌋\n", - " 506 = ⌊(4!*(√4^4.4))⌋\n", - " 507 = ⌈(4!*(√4^4.4))⌉\n", - " 508 = (√4*(4^4))-4\n", - " 509 = ⌈(4!*(4!-√(4+4)))⌉\n", - " 510 = (√4*(4^4))-√4\n", - " 511 = (√4*(4^4))-⌈.4⌉\n", - " 512 = (4^4)+(4^4)\n", - " 513 = ⌈.4⌉+(√4*(4^4))\n", - " 514 = √4+(√4*(4^4))\n", - " 515 = ⌈(4*((4-√.4)^4))⌉\n", - " 516 = 4+(√4*(4^4))\n", - " 517 = ⌊(4!*(√4!*4.4))⌋\n", - " 518 = ⌊(.4*((4!/4)^4))⌋\n", - " 519 = ⌈(.4*((4!/4)^4))⌉\n", - " 520 = √4*(4+(4^4))\n", - " 521 = ⌊(.4^-(4+√(4+4)))⌋\n", - " 522 = ⌈(.4^-(4+√(4+4)))⌉\n", - " 523 = ⌊((.4+4!)^(.4*√4!))⌋\n", - " 524 = (4!*(4!-√4))-4\n", - " 525 = ⌈√44⌉!/(.4*4!)\n", - " 526 = (4!*(4!-√4))-√4\n", - " 527 = ⌊((44^√√4)/.4)⌋\n", - " 528 = 4!*(44/√4)\n", - " 529 = (4!-(4/4))^√4\n", - " 530 = ⌊((.4+4.4)^4)⌋\n", - " 531 = ⌈((.4+4.4)^4)⌉\n", - " 532 = (4!*4!)-44\n", - " 533 = 4+((⌈.4⌉-4!)^√4)\n", - " 534 = ⌊(4!*(4!-(4^.4)))⌋\n", - " 535 = ⌈(4!*(4!-(4^.4)))⌉\n", - " 536 = 4!+(√4*(4^4))\n", - " 537 = ⌊(4!*(4!-(.4*4)))⌋\n", - " 538 = ⌊(44*(√4!/.4))⌋\n", - " 539 = ⌈(44*(√4!/.4))⌉\n", - " 540 = ⌈(√4!*44)⌉/.4\n", - " 541 = ⌊(4!*(4!-(.4^-.4)))⌋\n", - " 542 = ⌊(4!*(4!-.4))⌋-4!\n", - " 543 = ⌊(4^(44^.4))⌋\n", - " 544 = ⌈(4^(44^.4))⌉\n", - " 545 = ⌊(4^(√4/.44))⌋\n", - " 546 = ⌈(4^(√4/.44))⌉\n", - " 547 = ⌈(4!*(4!-(√4!/4)))⌉\n", - " 548 = (4!*4!)-(4+4!)\n", - " 549 = ⌈(4*(√4!*(4+4!)))⌉\n", - " 550 = (4!*4!)-(4!+√4)\n", - " 551 = (4!*4!)-(⌈.4⌉+4!)\n", - " 552 = 4!*(4!-(4/4))\n", - " 553 = ⌈.4⌉+((4!*4!)-4!)\n", - " 554 = √4+((4!*4!)-4!)\n", - " 555 = ⌊((4!-.44)^√4)⌋\n", - " 556 = 4+((4!*4!)-4!)\n", - " 557 = ⌈(4!*(4!-(.4+.4)))⌉\n", - " 558 = ⌈(.4+((.4-4!)^√4))⌉\n", - " 559 = ⌊(4!*(4!-(.4^.4)))⌋\n", - " 560 = (4+4!)*(4!-4)\n", - " 561 = ⌈(4*(4^(4!^.4)))⌉\n", - " 562 = ⌊(4!*(4!-.4))⌋-4\n", - " 563 = ⌈(4!*(4!-.4))⌉-4\n", - " 564 = 4!*(4!-(√4/4))\n", - " 565 = ⌊(4!*(4!-.44))⌋\n", - " 566 = (4!*4!)-(4/.4)\n", - " 567 = ⌊(4^(4+(4^-.4)))⌋\n", - " 568 = (4!*4!)-(4+4)\n", - " 569 = (4!*4!)-⌈√44⌉\n", - " 570 = (4!*4!)-(4!/4)\n", - " 571 = (4!*4!)-⌈4.4⌉\n", - " 572 = (4!^(4-√4))-4\n", - " 573 = ⌈.4⌉+((4!*4!)-4)\n", - " 574 = √4+((4!*4!)-4)\n", - " 575 = (4!*4!)-(4/4)\n", - " 576 = 4!^((4+4)/4)\n", - " 577 = (4/4)+(4!*4!)\n", - " 578 = 4+((4!*4!)-√4)\n", - " 579 = 4+((4!*4!)-⌈.4⌉)\n", - " 580 = ((4^4)-4!)/.4\n", - " 581 = ⌊((4^4)/.44)⌋\n", - " 582 = ⌈((4^4)/.44)⌉\n", - " 583 = (4!*4!)+⌈√44⌉\n", - " 584 = 4+(4+(4!*4!))\n", - " 585 = ⌊((4!*(.4+4!))-.4)⌋\n", - " 586 = (4/.4)+(4!*4!)\n", - " 587 = ⌈(4!*(4!+.44))⌉\n", - " 588 = 4*⌊(4^(4-.4))⌋\n", - " 589 = ⌈(4*(4^(4-.4)))⌉\n", - " 590 = ⌊(.4^(4*-(4^.4)))⌋\n", - " 591 = ⌈(.4^(4*-(4^.4)))⌉\n", - " 592 = (4*4)+(4!*4!)\n", - " 593 = ⌈((4.4^4)/√.4)⌉\n", - " 594 = ⌊((4!/4)^(4!^.4))⌋\n", - " 595 = ⌊((.4+4!)*(.4+4!))⌋\n", - " 596 = 4!+((4!*4!)-4)\n", - " 597 = ⌊((4!+.44)^√4)⌋\n", - " 598 = 4!+((4!*4!)-√4)\n", - " 599 = 4+⌊((.4+4!)^√4)⌋\n", - " 600 = 4!/(.44-.4)\n", - " 601 = (⌈4.4⌉^4)-4!\n", - " 602 = 4!+(√4+(4!*4!))\n", - " 603 = ⌊((4!+(4^-.4))^√4)⌋\n", - " 604 = 4+(4!+(4!*4!))\n", - " 605 = ⌈((4-.4)^⌈4.4⌉)⌉\n", - " 606 = ⌊(4!*(4!+√(.4*4)))⌋\n", - " 607 = ⌊(4*(4*(4!/√.4)))⌋\n", - " 608 = 4*(4*⌈(4!/√.4)⌉)\n", - " 609 = 4!+⌊(4!*(.4+4!))⌋\n", - " 610 = ⌊(.4/(.4^(4+4)))⌋\n", - " 611 = ⌈(.4/(.4^(4+4)))⌉\n", - " 612 = ⌈(4^(4+√.4))⌉-4\n", - " 613 = ⌊((√.4-.4)^-4.4)⌋\n", - " 614 = ⌊(4!*(4!+(.4*4)))⌋\n", - " 615 = ⌈(4!*(4!+(.4*4)))⌉\n", - " 616 = ((4^4)/.4)-4!\n", - " 617 = ⌊(4!*(4!+(4^.4)))⌋\n", - " 618 = ⌈(4!*(4!+(4^.4)))⌉\n", - " 619 = 4+⌊(4^(4+√.4))⌋\n", - " 620 = 44+(4!*4!)\n", - " 621 = (⌈4.4⌉^4)-4\n", - " 622 = (4!*(4!+√4))-√4\n", - " 623 = (⌈4.4⌉^4)-√4\n", - " 624 = (4!/4)!-(4*4!)\n", - " 625 = (4+(4/4))^4\n", - " 626 = ⌈.4⌉+(⌈4.4⌉^4)\n", - " 627 = ⌊(√√4*444)⌋\n", - " 628 = 4*⌈(4/(.4^4))⌉\n", - " 629 = 4+(⌈4.4⌉^4)\n", - " 630 = ((4^4)-4)/.4\n", - " 631 = ⌈(√√4*(4^4.4))⌉\n", - " 632 = ⌊((4/4!)^(.4-4))⌋\n", - " 633 = ⌈((4/4!)^(.4-4))⌉\n", - " 634 = ⌊(4^√4!)⌋-(4^4)\n", - " 635 = ((4^4)-√4)/.4\n", - " 636 = ((4^4)/.4)-4\n", - " 637 = ⌈(4*(4!*√44))⌉\n", - " 638 = ((4^4)/.4)-√4\n", - " 639 = ((4^4)-.4)/.4\n", - " 640 = (4^√(4*4))/.4\n", - " 641 = (.4+(4^4))/.4\n", - " 642 = √4+((4^4)/.4)\n", - " 643 = ⌊(4!*(4!+√(4+4)))⌋\n", - " 644 = 4+((4^4)/.4)\n", - " 645 = (√4+(4^4))/.4\n", - " 646 = ⌊(4*(4!^(.4*4)))⌋\n", - " 647 = ⌈(4*(4!^(.4*4)))⌉\n", - " 648 = (4!*(4+4!))-4!\n", - " 649 = 4!+(⌈4.4⌉^4)\n", - " 650 = (4+(4^4))/.4\n", - " 651 = ⌊(.4^(√(4+4)/-.4))⌋\n", - " 652 = ((4!+√4)^√4)-4!\n", - " 653 = ⌈((√4!+(4^4))/.4)⌉\n", - " 654 = ⌊((4+4!)*(4!-√.4))⌋\n", - " 655 = ⌊((4*√(.4*4))^4)⌋\n", - " 656 = ⌈((4*√(.4*4))^4)⌉\n", - " 657 = ⌈(4!^√(4+(4/4!)))⌉\n", - " 658 = ⌊((√4!+(4/4!))^4)⌋\n", - " 659 = ⌈((√4!+(4/4!))^4)⌉\n", - " 660 = (4!/4)!-(4!/.4)\n", - " 661 = ⌈((4+4!)*(4!-.4))⌉\n", - " 662 = ⌊(4!*(4+(4!-.4)))⌋\n", - " 663 = ⌈(4!*(4+(4!-.4)))⌉\n", - " 664 = 4!+((4^4)/.4)\n", - " 665 = ⌊(4*(4!*√(4!+4!)))⌋\n", - " 666 = ⌊(4^√(44/√4))⌋\n", - " 667 = ⌊(√.4*(4!*44))⌋\n", - " 668 = (4!*(4+4!))-4\n", - " 669 = ⌊(4^(4+(.4^.4)))⌋\n", - " 670 = (4!*(4+4!))-√4\n", - " 671 = ⌊(4*((.4-4)^4))⌋\n", - " 672 = .4*((4+4)!/4!)\n", - " 673 = ⌈.4⌉+(4!*(4+4!))\n", - " 674 = √4+(4!*(4+4!))\n", - " 675 = ⌊(√4!^(4+(.4/4)))⌋\n", - " 676 = (4!/4)!-44\n", - " 677 = ⌊(4.4^4.4)⌋\n", - " 678 = ⌈(4.4^4.4)⌉\n", - " 679 = ⌊(4^((4!+4!)^.4))⌋\n", - " 680 = 4+((4!+√4)^√4)\n", - " 681 = ⌊(4!*(4!+4.4))⌋\n", - " 682 = ⌈(4!*(4!+4.4))⌉\n", - " 683 = ⌊((.4+4!)*(4+4!))⌋\n", - " 684 = ⌈((.4+4!)*(4+4!))⌉\n", - " 685 = ⌊(.4^(4!/(√.4-4)))⌋\n", - " 686 = ⌈(.4^(4!/(√.4-4)))⌉\n", - " 687 = ⌊((.4*.4)^-(4!^.4))⌋\n", - " 688 = ⌈((.4*.4)^-(4!^.4))⌉\n", - " 689 = ⌊((4+4!)*(√.4+4!))⌋\n", - " 690 = ⌈((4+4!)*(√.4+4!))⌉\n", - " 691 = ⌊(4!*(4!/(√.4^.4)))⌋\n", - " 692 = (4!/4)!-(4+4!)\n", - " 693 = ⌊(.4+(4!*(4!+√4!)))⌋\n", - " 694 = (4!/4)!-(4!+√4)\n", - " 695 = ⌊((4!/4)!-(.4+4!))⌋\n", - " 696 = ((4/.4)-4)!-4!\n", - " 697 = ⌈.4⌉+((4!/4)!-4!)\n", - " 698 = √4+((4!/4)!-4!)\n", - " 699 = ⌊((4!/.4)^(.4*4))⌋\n", - " 700 = (4!+(4^4))/.4\n", - " 701 = (4!/4)!-⌊(4*√4!)⌋\n", - " 702 = ⌊(444/√.4)⌋\n", - " 703 = ⌈(444/√.4)⌉\n", - " 704 = 4*(4*44)\n", - " 705 = ⌈((4^4.4)/√.4)⌉\n", - " 706 = ⌊(4^(√4!-(4/4!)))⌋\n", - " 707 = ⌈(4^(√4!-(4/4!)))⌉\n", - " 708 = (4!/4)!-(4!/√4)\n", - " 709 = ⌈(.4^-(4+√(4/.4)))⌉\n", - " 710 = (4!/4)!-(4/.4)\n", - " 711 = ⌊(.44^-(4+4))⌋\n", - " 712 = (4!/4)!-(4+4)\n", - " 713 = ⌊((4!/4)!-√44)⌋\n", - " 714 = (4!/4)!-(4!/4)\n", - " 715 = ⌊((4!/4)!-4.4)⌋\n", - " 716 = ((4/.4)-4)!-4\n", - " 717 = ⌊((4+4)^√(4/.4))⌋\n", - " 718 = ((4/.4)-4)!-√4\n", - " 719 = (4!/4)!-(4/4)\n", - " 720 = (4+((4+4)/4))!\n", - " 721 = (4/4)+(4!/4)!\n", - " 722 = √4+((4/.4)-4)!\n", - " 723 = 4+⌊((4!/4)!-.4)⌋\n", - " 724 = 4+((4/.4)-4)!\n", - " 725 = ⌈4.4⌉+(4!/4)!\n", - " 726 = ⌊(44^(4^.4))⌋\n", - " 727 = ⌈(44^(4^.4))⌉\n", - " 728 = 4+(4+(4!/4)!)\n", - " 729 = (4-⌈.4⌉)^(4!/4)\n", - " 730 = (4/.4)+(4!/4)!\n", - " 731 = ⌊((4+(√.4^-.4))^4)⌋\n", - " 732 = (4!/√4)+(4!/4)!\n", - " 733 = ⌊((.4*.4)^(.4-4))⌋\n", - " 734 = ⌈((.4*.4)^(.4-4))⌉\n", - " 735 = ⌊(4!*(4!+√44))⌋\n", - " 736 = (4*4)+(4!/4)!\n", - " 737 = ⌊((4!+√(4/.4))^√4)⌋\n", - " 738 = ⌈((4!+√(4/.4))^√4)⌉\n", - " 739 = (4!/4)!+⌊(4*√4!)⌋\n", - " 740 = 4!+((4!/4)!-4)\n", - " 741 = ⌊((√√4-√44)^4)⌋\n", - " 742 = (4!-√4)+(4!/4)!\n", - " 743 = 4!+⌊((4!/4)!-.4)⌋\n", - " 744 = 4!+((4/.4)-4)!\n", - " 745 = ⌊((4+(√4!/4))^4)⌋\n", - " 746 = 4!+(√4+(4!/4)!)\n", - " 747 = ⌊((√4!-.4)^4.4)⌋\n", - " 748 = 4+(4!+(4!/4)!)\n", - " 749 = ⌊(√4*(4.4^4))⌋\n", - " 750 = √4*⌈(4.4^4)⌉\n", - " 751 = ⌈(√4!^(4+(4/4!)))⌉\n", - " 752 = ⌊(√4^(.4*4!))⌋-4!\n", - " 753 = ⌈(√4^(.4*4!))⌉-4!\n", - " 754 = ⌊(4.4^√(4!-4))⌋\n", - " 755 = ⌈(4.4^√(4!-4))⌉\n", - " 756 = 4*⌊(⌈4.4⌉!/√.4)⌋\n", - " 757 = (4!/4)!+⌊(4!/√.4)⌋\n", - " 758 = ⌊(4!*((4!-4)/√.4))⌋\n", - " 759 = ⌊(.4^-4)⌋+(4!/4)!\n", - " 760 = ((4+4!)^√4)-4!\n", - " 761 = ⌊((.4-(4+4!))^√4)⌋\n", - " 762 = ⌊((.4^-(4+4))/√4)⌋\n", - " 763 = ⌈(.4^-(4+4))⌉/√4\n", - " 764 = 44+(4!/4)!\n", - " 765 = ⌊((4/√.4)^(4-.4))⌋\n", - " 766 = ⌈((4/√.4)^(4-.4))⌉\n", - " 767 = ⌈(4^√(4+4!))⌉/√4\n", - " 768 = 4*(4!*(4+4))\n", - " 769 = ⌈((4+√(.4*4))^4)⌉\n", - " 770 = ⌊((44/.4)^√√4)⌋\n", - " 771 = ⌊(4^√(4!-(4/4)))⌋\n", - " 772 = ⌈(4^√(4!-(4/4)))⌉\n", - " 773 = ⌈(√4^(.4*4!))⌉-4\n", - " 774 = ⌊(.4*(44^√4))⌋\n", - " 775 = ⌈(.4*(44^√4))⌉\n", - " 776 = ⌊(4^(.4+4.4))⌋\n", - " 777 = ⌈(4^(.4+4.4))⌉\n", - " 778 = ⌊(.4^-(√.4+√44))⌋\n", - " 779 = ⌊(4!*(√4!*√44))⌋\n", - " 780 = ((4+4!)^√4)-4\n", - " 781 = ⌊((4!-4)/(.4^4))⌋\n", - " 782 = ⌈((4!-4)/(.4^4))⌉\n", - " 783 = ⌈((4*4)^(4^√.4))⌉\n", - " 784 = (4+4!)*(4+4!)\n", - " 785 = ⌊(4.4^(√4!-.4))⌋\n", - " 786 = √4+((4+4!)^√4)\n", - " 787 = ⌈((4-(.4/4))^√4!)⌉\n", - " 788 = 4+((4+4!)^√4)\n", - " 789 = ⌈(.4+((.4+√4!)^4))⌉\n", - " 790 = ⌈(4!*(4+(4!+√4!)))⌉\n", - " 791 = ⌊(4!^(√4+(.4/4)))⌋\n", - " 792 = 4+⌊((.4+√4!)^4)⌋\n", - " 793 = ⌊(4^(4+(4/√4!)))⌋\n", - " 794 = ⌈(4^(4+(4/√4!)))⌉\n", - " 795 = ⌊(√44*⌈4.4⌉!)⌋\n", - " 796 = ⌊(4!*((.4+√4)^4))⌋\n", - " 797 = ⌈(4!*((.4+√4)^4))⌉\n", - " 798 = ⌊(4!^(4-√(4-.4)))⌋\n", - " 799 = ⌈(4!^(4-√(4-.4)))⌉\n", - " 800 = ((4/√.4)^4)/√4\n", - " 801 = ⌈((4+(√4^.4))^4)⌉\n", - " 802 = ⌊((4-(√4/4!))^√4!)⌋\n", - " 803 = ⌊(√44^(√√4/.4))⌋\n", - " 804 = ⌈(√44^(√√4/.4))⌉\n", - " 805 = ⌈((4!/4)!/√(.4+.4))⌉\n", - " 806 = ⌊((4!+4.4)^√4)⌋\n", - " 807 = ⌈((4!+4.4)^√4)⌉\n", - " 808 = 4!+((4+4!)^√4)\n", - " 809 = ⌊((4^4)*√(4/.4))⌋\n", - " 810 = ⌈((4^4)*√(4/.4))⌉\n", - " 811 = ⌊(4^(4+(√.4^.4)))⌋\n", - " 812 = ⌊((√4!+.44)^4)⌋\n", - " 813 = ⌈((√4!+.44)^4)⌉\n", - " 814 = ⌊((4+4)!^√.4)⌋-4\n", - " 815 = ⌈((4+4)!^√.4)⌉-4\n", - " 816 = 4!*(4!+(4/.4))\n", - " 817 = ⌊(((4+4)!^√.4)-.4)⌋\n", - " 818 = ⌊((4+(4+4)!)^√.4)⌋\n", - " 819 = ⌈((4+(4+4)!)^√.4)⌉\n", - " 820 = ⌈(√.4*((4!/4)^4))⌉\n", - " 821 = ⌊(.4*(4!^(.4+√4)))⌋\n", - " 822 = 4+⌊((4+4)!^√.4)⌋\n", - " 823 = 4+⌈((4+4)!^√.4)⌉\n", - " 824 = ⌊((4-(4^-√4))^√4!)⌋\n", - " 825 = ⌈((4-(4^-√4))^√4!)⌉\n", - " 826 = ⌈(4!^(.4^(-4/√4!)))⌉\n", - " 827 = ⌊((√√4^.4)*(4!/4)!)⌋\n", - " 828 = ⌊(4!*(√√4*(.4+4!)))⌋\n", - " 829 = ⌊((4!/√(4!-4))^4)⌋\n", - " 830 = ⌊(4!*(4!/(.4^.4)))⌋\n", - " 831 = ⌈(4!*(4!/(.4^.4)))⌉\n", - " 832 = (4^4)+(4!*4!)\n", - " 833 = ⌊(√4!^(4+(√.4-.4)))⌋\n", - " 834 = ⌊((.4*√4!)^(4/.4))⌋\n", - " 835 = ⌈((.4*√4!)^(4/.4))⌉\n", - " 836 = 44*⌊(4*√4!)⌋\n", - " 837 = ⌈(((4+4)^4)/√4!)⌉\n", - " 838 = ⌈(4^√(4!-.4))⌉-4\n", - " 839 = ⌊((√√4-(.4*4))^-4)⌋\n", - " 840 = (4+4)!/(4!+4!)\n", - " 841 = ⌊(4!*((.4^-4)-4))⌋\n", - " 842 = ⌈(4!*((.4^-4)-4))⌉\n", - " 843 = ⌊(4*(44^√√4))⌋\n", - " 844 = 4*⌈(44^√√4)⌉\n", - " 845 = ⌊((4!+4!)^(4^.4))⌋\n", - " 846 = ⌊(4^√4!)⌋-44\n", - " 847 = ⌈(4^√4!)⌉-44\n", - " 848 = ⌊(√√4*(4!+(4!*4!)))⌋\n", - " 849 = ⌊((√4!+(√4/4))^4)⌋\n", - " 850 = ⌊((4+√.4)^4.4)⌋\n", - " 851 = ⌈((4+√.4)^4.4)⌉\n", - " 852 = 4*⌊(4!*(4+√4!))⌋\n", - " 853 = ⌈((.4+(4!^.4))^√4!)⌉\n", - " 854 = ⌊(.4^(√.4-(4+4)))⌋\n", - " 855 = ⌈(.4^(√.4-(4+4)))⌉\n", - " 856 = 4*⌈(4!*(4+√4!))⌉\n", - " 857 = ⌊(4^(.4+√(4!-4)))⌋\n", - " 858 = ⌊(44^(.4^-√.4))⌋\n", - " 859 = ⌈(44^(.4^-√.4))⌉\n", - " 860 = 4*⌊(√4!*44)⌋\n", - " 861 = √4+⌊((4+√√4)^4)⌋\n", - " 862 = ⌊(4*(√4!*44))⌋\n", - " 863 = ⌈(4*(√4!*44))⌉\n", - " 864 = 4!*((4!/.4)-4!)\n", - " 865 = 4!+⌊(4^√(4!-.4))⌋\n", - " 866 = 4!+⌈(4^√(4!-.4))⌉\n", - " 867 = ⌊(√4^(.4*(.4+4!)))⌋\n", - " 868 = ⌈(√4^(.4*(.4+4!)))⌉\n", - " 869 = ⌊(4^√(4!-(4/4!)))⌋\n", - " 870 = ⌊(√4^((.4^-4)/4))⌋\n", - " 871 = ⌈(√4^((.4^-4)/4))⌉\n", - " 872 = ⌊(√4/(.4^√44))⌋\n", - " 873 = ⌈(√4/(.4^√44))⌉\n", - " 874 = ⌊(4!^(√44^.4))⌋\n", - " 875 = ⌈(4!^(√44^.4))⌉\n", - " 876 = ⌊((√(4+4!)^√4!)/4)⌋\n", - " 877 = ⌊((4+(.4^-.4))^4)⌋\n", - " 878 = ⌈((4+(.4^-.4))^4)⌉\n", - " 879 = ⌈((4-.4)^√(4+4!))⌉\n", - " 880 = 44*(4!-4)\n", - " 881 = ⌊(4^(√(4+4!)-.4))⌋\n", - " 882 = ⌊(4^√4!)⌋-(4+4)\n", - " 883 = ⌈(4^√4!)⌉-(4+4)\n", - " 884 = ⌊(4^(4+√(.4+.4)))⌋\n", - " 885 = ⌊((4!/4.4)^4)⌋\n", - " 886 = ⌈((4!/4.4)^4)⌉\n", - " 887 = ⌈(.4+(4^√4!))⌉-4\n", - " 888 = √4*444\n", - " 889 = ⌊((4^√4!)-.44)⌋\n", - " 890 = √4*⌊(4^4.4)⌋\n", - " 891 = ⌊(√4*(4^4.4))⌋\n", - " 892 = √4*⌈(4^4.4)⌉\n", - " 893 = 4+⌊((4^√4!)-.4)⌋\n", - " 894 = ⌊(4.4+(4^√4!))⌋\n", - " 895 = ⌈(4.4+(4^√4!))⌉\n", - " 896 = ⌊((4^√4!)+√44)⌋\n", - " 897 = ⌈((4^√4!)+√44)⌉\n", - " 898 = 4+(4+⌊(4^√4!)⌋)\n", - " 899 = 4+(4+⌈(4^√4!)⌉)\n", - " 900 = (4!/4)!/(.4+.4)\n", - " 901 = ⌊(4!^(.4+(4^.4)))⌋\n", - " 902 = ⌈(4!^(.4+(4^.4)))⌉\n", - " 903 = ⌈(4^√(4!+(.4/4)))⌉\n", - " 904 = ⌊(((4!*4!)-4)/√.4)⌋\n", - " 905 = ⌊(√√4*(4^4))⌋/.4\n", - " 906 = (4*4)+⌊(4^√4!)⌋\n", - " 907 = (4*4)+⌈(4^√4!)⌉\n", - " 908 = ⌊(√44^(4-.4))⌋\n", - " 909 = ⌈(√44^(4-.4))⌉\n", - " 910 = 4!+(⌊(4^√4!)⌋-4)\n", - " 911 = 4!+(⌈(4^√4!)⌉-4)\n", - " 912 = ⌊((4^4)*(4!^.4))⌋\n", - " 913 = ⌈((4^4)*(4!^.4))⌉\n", - " 914 = ⌈(4!/(.4^4))⌉-4!\n", - " 915 = ⌊(((4!-√4)/4)^4)⌋\n", - " 916 = ⌊((4+4)!/44)⌋\n", - " 917 = ⌈((4+4)!/44)⌉\n", - " 918 = 4+(4!+⌊(4^√4!)⌋)\n", - " 919 = 4+(4!+⌈(4^√4!)⌉)\n", - " 920 = 4*⌊(.4*(4!*4!))⌋\n", - " 921 = ⌊((4-.4)*(4^4))⌋\n", - " 922 = ⌈((4-.4)*(4^4))⌉\n", - " 923 = ⌈(4^(√4!+(.4^4)))⌉\n", - " 924 = 4*⌈(.4*(4!*4!))⌉\n", - " 925 = ⌊(4!*((.4+4!)/√.4))⌋\n", - " 926 = ⌊((4!^(4-√√4))/4)⌋\n", - " 927 = ⌊(4!*((.4^-4)-.4))⌋\n", - " 928 = 4*((4^4)-4!)\n", - " 929 = ⌊(4^(.4^-(4^.4)))⌋\n", - " 930 = ⌈(4^(.4^-(4^.4)))⌉\n", - " 931 = ⌈(.4^-4)⌉+⌈(4^√4!)⌉\n", - " 932 = (4!*⌊(.4^-4)⌋)-4\n", - " 933 = ⌊(4!/(.4^4))⌋-4\n", - " 934 = 44+⌊(4^√4!)⌋\n", - " 935 = ⌊(4.4^4)⌋/.4\n", - " 936 = 4!*⌈(.4*(4*4!))⌉\n", - " 937 = ⌊((4.4^4)/.4)⌋\n", - " 938 = ⌈((4.4^4)/.4)⌉\n", - " 939 = ⌈(4!*(44-√4!))⌉\n", - " 940 = 4+(4!*⌊(.4^-4)⌋)\n", - " 941 = 4+⌊(4!/(.4^4))⌋\n", - " 942 = 4+⌈(4!/(.4^4))⌉\n", - " 943 = ⌈(.4+(4^√(.4+4!)))⌉\n", - " 944 = (4!-.4)*⌈(.4^-4)⌉\n", - " 945 = 4+⌊(4^√(.4+4!))⌋\n", - " 946 = 4+⌈(4^√(.4+4!))⌉\n", - " 947 = ⌊(4!*(.4+(.4^-4)))⌋\n", - " 948 = ⌈(4!*(.4+(.4^-4)))⌉\n", - " 949 = ⌈((4+√(.4+√4))^4)⌉\n", - " 950 = (4!/.4)+⌊(4^√4!)⌋\n", - " 951 = (4!/.4)+⌈(4^√4!)⌉\n", - " 952 = ⌊(4!*(√.4+(.4^-4)))⌋\n", - " 953 = ⌊((.4+4!)/(.4^4))⌋\n", - " 954 = ⌈((.4+4!)/(.4^4))⌉\n", - " 955 = ⌊(4^√(4!+(√4/4)))⌋\n", - " 956 = ⌊(4.4^(4+√.4))⌋\n", - " 957 = ⌈(4.4^(4+√.4))⌉\n", - " 958 = ⌊(44^(.4+√√4))⌋\n", - " 959 = ⌈(44^(.4+√√4))⌉\n", - " 960 = 4!*(44-4)\n", - " 961 = 4!+⌊(4!/(.4^4))⌋\n", - " 962 = 4!+⌈(4!/(.4^4))⌉\n", - " 963 = ⌈((√.4+4!)/(.4^4))⌉\n", - " 964 = 4+(4!*⌈(.4^-4)⌉)\n", - " 965 = ⌊(√.4/(.4^(4+4)))⌋\n", - " 966 = ⌈(√.4/(.4^(4+4)))⌉\n", - " 967 = ⌊(.4^-(.4+(4^√√4)))⌋\n", - " 968 = 44*(4!-√4)\n", - " 969 = ⌈((4!*(.4-√.4))^4)⌉\n", - " 970 = ⌊((4+(√.4/.4))^4)⌋\n", - " 971 = ⌈((4+(√.4/.4))^4)⌉\n", - " 972 = ⌈(.4^-(√.4^-4.4))⌉\n", - " 973 = ⌈((4^(4+√.4))/√.4)⌉\n", - " 974 = ⌈((√.4*4!)^(4*√.4))⌉\n", - " 975 = ⌊(4!^(.4*(4+√√4)))⌋\n", - " 976 = (4^4)+(4!/4)!\n", - " 977 = ⌈(4/(.4^(4!/4)))⌉\n", - " 978 = ⌊(4!^(√4+(4/4!)))⌋\n", - " 979 = ⌈(4!^(√4+(4/4!)))⌉\n", - " 980 = 4*⌈(.4^(4!/-4))⌉\n", - " 981 = ⌈(√.4*(4^(.4+√4!)))⌉\n", - " 982 = ⌊((4+(.4/√4!))^√4!)⌋\n", - " 983 = ⌊((4+(.4*4))^4)⌋\n", - " 984 = ⌈((4+(.4*4))^4)⌉\n", - " 985 = ⌊(4!*(√4+(.4^-4)))⌋\n", - " 986 = (4*4!)+⌊(4^√4!)⌋\n", - " 987 = (4*4!)+⌈(4^√4!)⌉\n", - " 988 = ⌊((⌈4.4⌉^4)/√.4)⌋\n", - " 989 = ⌊(√(4+4)^√44)⌋\n", - " 990 = ⌈(√(4+4)^√44)⌉\n", - " 991 = ⌈(√(4!-⌈.4⌉)^4.4)⌉\n", - " 992 = ⌊((4!+√√4)/(.4^4))⌋\n", - " 993 = ⌊(44*(4!-√√4))⌋\n", - " 994 = ⌈(44*(4!-√√4))⌉\n", - " 995 = ⌊(4^√(4!+(.4+.4)))⌋\n", - " 996 = ⌈(4^√(4!+(.4+.4)))⌉\n", - " 997 = ⌈(4^((.4+4!)/√4!))⌉\n", - " 998 = ⌊((4^4)*(√4!-⌈.4⌉))⌋\n", - " 999 = ⌊(⌈4.4⌉!^(.4^-.4))⌋\n", - "1000 = (4*(4^4))-4!\n", - "1001 = ⌊(4!^(4^(.4^√.4)))⌋\n", - "1002 = ⌊(4!*(4!*(4^.4)))⌋\n", - "1003 = ⌈(4!*(4!*(4^.4)))⌉\n", - "1004 = 4*⌊((4^4)-√4!)⌋\n", - "1005 = ⌈(4*((4^4)-√4!))⌉\n", - "1006 = ⌊(4!*(4+(4!/√.4)))⌋\n", - "1007 = ⌊((⌈.4⌉-√44)^4)⌋\n", - "1008 = 4*((4^4)-4)\n", - "1009 = ⌈(√4!^((4^.4)/.4))⌉\n", - "1010 = ⌊((4^4)/√.4)⌋/.4\n", - "1011 = ⌊(4*(4!^(4^.4)))⌋\n", - "1012 = 44*(4!-⌈.4⌉)\n", - "1013 = ⌈(.4^(4*-(√4!^.4)))⌉\n", - "1014 = (4!+√4)*⌊(.4^-4)⌋\n", - "1015 = ⌊((4!+√4)/(.4^4))⌋\n", - "1016 = 4*((4^4)-√4)\n", - "1017 = ⌈(((4!-√√4)/4)^4)⌉\n", - "1018 = ⌊(4*((4^4)-√√4))⌋\n", - "1019 = ⌊((4*(4^4))-√4!)⌋\n", - "1020 = (4*(4^4))-4\n", - "1021 = ⌊(4*((4^4)-√.4))⌋\n", - "1022 = (4*(4^4))-√4\n", - "1023 = (4*(4^4))-⌈.4⌉\n", - "1024 = 4^(4+(4/4))\n", - "1025 = ⌈.4⌉+(4*(4^4))\n", - "1026 = √4+(4*(4^4))\n", - "1027 = ⌈(4*(√.4+(4^4)))⌉\n", - "1028 = 4+(4*(4^4))\n", - "1029 = ⌈(44*(4!-√.4))⌉\n", - "1030 = ⌈(4*(√√4+(4^4)))⌉\n", - "1031 = ⌈(⌈√44⌉^(4!^.4))⌉\n", - "1032 = (4!*44)-4!\n", - "1033 = ⌈((.4^4)*(4+4)!)⌉\n", - "1034 = ⌈(4!*(4+(.4^-4)))⌉\n", - "1035 = ⌈(4!*(4!+(4!-√4!)))⌉\n", - "1036 = (4+4!)*⌊(4!/√.4)⌋\n", - "1037 = ⌊(4!^(.4+(.4^-√.4)))⌋\n", - "1038 = ⌊(44*(4!-.4))⌋\n", - "1039 = ⌈(44*(4!-.4))⌉\n", - "1040 = 4*(4+(4^4))\n", - "1041 = ⌈(4!*(44-√.4))⌉\n", - "1042 = ⌊((.4*.44)^-4)⌋\n", - "1043 = ⌈((.4*.44)^-4)⌉\n", - "1044 = 4*⌈(√4!+(4^4))⌉\n", - "1045 = ⌈(4^(4+(√√4-.4)))⌉\n", - "1046 = ⌊(4!*(44-.4))⌋\n", - "1047 = ⌈(4!*(44-.4))⌉\n", - "1048 = 4!+(4*(4^4))\n", - "1049 = ⌈(√(4!-.4)^4.4)⌉\n", - "1050 = ⌈(((4-.4)/√.4)^4)⌉\n", - "1051 = ⌊((4!*44)-√4!)⌋\n", - "1052 = (4!*44)-4\n", - "1053 = ⌈(√√4*(4!+(4!/4)!))⌉\n", - "1054 = (4!*44)-√4\n", - "1055 = (4!*44)-⌈.4⌉\n", - "1056 = 44*√(4*4)!\n", - "1057 = ⌈.4⌉+(4!*44)\n", - "1058 = √4+(4!*44)\n", - "1059 = ⌊(4^((4*√√4)-√.4))⌋\n", - "1060 = 4+(4!*44)\n", - "1061 = ⌈(√4!+(4!*44))⌉\n", - "1062 = ⌊(√.4*((4+4)!/4!))⌋\n", - "1063 = ⌊(√4!^4.4)⌋-4!\n", - "1064 = ⌈(√4!^4.4)⌉-4!\n", - "1065 = ⌊(4!*44.4)⌋\n", - "1066 = ⌈(4!*44.4)⌉\n", - "1067 = ⌊(((4+4!)/√4!)^4)⌋\n", - "1068 = ⌈(((4+4!)/√4!)^4)⌉\n", - "1069 = ⌈(4!/(√4*(.4^√4!)))⌉\n", - "1070 = ⌈((4^√4!)/(√.4^.4))⌉\n", - "1071 = ⌊(4^(√.4+4.4))⌋\n", - "1072 = ⌈(4^(√.4+4.4))⌉\n", - "1073 = ⌊(44*(.4+4!))⌋\n", - "1074 = ⌈(44*(.4+4!))⌉\n", - "1075 = ⌈((4!^(√.4+√4))/4)⌉\n", - "1076 = ⌊((4+(√.4/4))^√4!)⌋\n", - "1077 = ⌈((4+(√.4/4))^√4!)⌉\n", - "1078 = ⌊((4+(.4*.4))^√4!)⌋\n", - "1079 = ⌈((4+(.4*.4))^√4!)⌉\n", - "1080 = 4!+(4!*44)\n", - "1081 = ⌊((4/4!)^(⌈.4⌉-√4!))⌋\n", - "1082 = ⌊((.4-(4^-.4))^-4)⌋\n", - "1083 = ⌊(44*(√.4+4!))⌋\n", - "1084 = ⌈(44*(√.4+4!))⌉\n", - "1085 = ⌊(√4!^4.4)⌋-√4\n", - "1086 = ⌊((4+(4^.4))^4)⌋\n", - "1087 = ⌈((4+(4^.4))^4)⌉\n", - "1088 = ⌈(4!^(4.4/√4))⌉\n", - "1089 = ⌊(4!*(√√4+44))⌋\n", - "1090 = ⌊(.4^-√44)⌋/.4\n", - "1091 = 4+⌊(√4!^4.4)⌋\n", - "1092 = (4+4!)*⌊(.4^-4)⌋\n", - "1093 = ⌊((4+4!)/(.4^4))⌋\n", - "1094 = ⌈((4+4!)/(.4^4))⌉\n", - "1095 = ⌊(⌈(.4^-4)⌉^√(4-.4))⌋\n", - "1096 = ⌈(⌈(.4^-4)⌉^√(4-.4))⌉\n", - "1097 = ⌊(.4^(.4*(√4!-4!)))⌋\n", - "1098 = ⌈(.4^(.4*(√4!-4!)))⌉\n", - "1099 = ⌊((4+4)^(4-√.4))⌋\n", - "1100 = 44*(⌈.4⌉+4!)\n", - "1101 = ⌈((.4+√4)^(4+4))⌉\n", - "1102 = ⌈((4^4)/(√.4-.4))⌉\n", - "1103 = ⌈(⌈√44⌉^(4-.4))⌉\n", - "1104 = 4!*(√4+44)\n", - "1105 = ⌈(4!^(4/(.4+√√4)))⌉\n", - "1106 = ⌊(((4+4)^√4!)/4!)⌋\n", - "1107 = ⌈(((4+4)^√4!)/4!)⌉\n", - "1108 = ⌊(4^(√4!+(√.4/4)))⌋\n", - "1109 = ⌊((4/(.4^.4))^4)⌋\n", - "1110 = 444/.4\n", - "1111 = 4!+⌊(√4!^4.4)⌋\n", - "1112 = ⌊(4^(4*√(.4*4)))⌋\n", - "1113 = ⌈(4^(4*√(.4*4)))⌉\n", - "1114 = ⌊((4^4.4)/.4)⌋\n", - "1115 = ⌈(4^4.4)⌉/.4\n", - "1116 = ⌈(√4!^(4+(4^-√.4)))⌉\n", - "1117 = ⌈((√4^√.4)*(4!/4)!)⌉\n", - "1118 = ⌊(44*(4!+√√4))⌋\n", - "1119 = ⌈(44*(4!+√√4))⌉\n", - "1120 = 4*(4!+(4^4))\n", - "1121 = ⌈((4+(.4^-√.4))^4)⌉\n", - "1122 = ⌈(4^(√4!+(4/4!)))⌉\n", - "1123 = ⌈((4!+4!)^(.4+√√4))⌉\n", - "1124 = 4*⌊(√(4/.4)^√4!)⌋\n", - "1125 = ⌈((√.4*√44)^√4!)⌉\n", - "1126 = ⌊(4.4*(4^4))⌋\n", - "1127 = ⌈(4.4*(4^4))⌉\n", - "1128 = (4!*(4!+4!))-4!\n", - "1129 = ⌈((4!+(.4*4!))^√4)⌉\n", - "1130 = ⌊((4-√(4*4!))^4)⌋\n", - "1131 = ⌈((4-√(4*4!))^4)⌉\n", - "1132 = ⌊((4!-.4)*(4!+4!))⌋\n", - "1133 = ⌈((4!-.4)*(4!+4!))⌉\n", - "1134 = √4*⌈(4!*(4!-.4))⌉\n", - "1135 = ⌈((4!/4)!/√.4)⌉-4\n", - "1136 = ⌊(√4!*((4^4)-4!))⌋\n", - "1137 = ⌈(√4!*((4^4)-4!))⌉\n", - "1138 = ⌊(((4/.4)-4)!/√.4)⌋\n", - "1139 = ⌈(((4/.4)-4)!/√.4)⌉\n", - "1140 = 4!*(⌊(4*√4!)⌋/.4)\n", - "1141 = ⌈(4!^(4-(.4^-√.4)))⌉\n", - "1142 = ⌊((√√4+4.4)^4)⌋\n", - "1143 = ⌈((√√4+4.4)^4)⌉\n", - "1144 = 44*(4!+√4)\n", - "1145 = ⌈((4^4)*√(4!-4))⌉\n", - "1146 = (4^4)+⌊(4^√4!)⌋\n", - "1147 = (4^4)+⌈(4^√4!)⌉\n", - "1148 = (4!*(4!+4!))-4\n", - "1149 = ⌈(4!^(4^(4^-.4)))⌉\n", - "1150 = (4!*(4!+4!))-√4\n", - "1151 = ⌊(((4+√.4)^4)/.4)⌋\n", - "1152 = 4!*(4+44)\n", - "1153 = ⌈.4⌉+(4!*(4!+4!))\n", - "1154 = √4+(4!*(4!+4!))\n", - "1155 = ⌈(4*(√4!^(4!^.4)))⌉\n", - "1156 = 4+(4!*(4!+4!))\n", - "1157 = ⌈(√4!+(4!*(4!+4!)))⌉\n", - "1158 = ⌊(√4!^4.44)⌋\n", - "1159 = ⌈(√4!^4.44)⌉\n", - "1160 = √4*(4+(4!*4!))\n", - "1161 = ⌊(4!*(.4+(4!+4!)))⌋\n", - "1162 = ⌈(4!*(.4+(4!+4!)))⌉\n", - "1163 = 4!+⌈((4!/4)!/√.4)⌉\n", - "1164 = ⌊(((√.4-4!)/4)^4)⌋\n", - "1165 = ⌈(((√.4-4!)/4)^4)⌉\n", - "1166 = ⌈((√4^√4!)/(.4^4))⌉\n", - "1167 = ⌊(4!*(√.4+(4!+4!)))⌋\n", - "1168 = 4*⌈(4!^(.4^-√.4))⌉\n", - "1169 = ⌊((4^√(4!+√4))-√4!)⌋\n", - "1170 = √4*⌊(4!*(.4+4!))⌋\n", - "1171 = ⌊((.4+4!)*(4!+4!))⌋\n", - "1172 = ⌈((.4+4!)*(4!+4!))⌉\n", - "1173 = ⌊(4!*(√4!+44))⌋\n", - "1174 = ⌈(4!*(√4!+44))⌉\n", - "1175 = ⌊(4*(4!*√4!))⌋/.4\n", - "1176 = 4!+(4!*(4!+4!))\n", - "1177 = ⌊(4^((4/.4)-√4!))⌋\n", - "1178 = ⌈(4^((4/.4)-√4!))⌉\n", - "1179 = 4+⌈(4^√(4!+√4))⌉\n", - "1180 = 4*(⌈(4!*√4!)⌉/.4)\n", - "1181 = ⌈(.4^-√((4!/.4)-.4))⌉\n", - "1182 = ⌊((√.4+4!)*(4!+4!))⌋\n", - "1183 = ⌈((√.4+4!)*(4!+4!))⌉\n", - "1184 = ⌈(4^(√.4+√(4!-4)))⌉\n", - "1185 = ⌊((4^4)*(4+√.4))⌋\n", - "1186 = ⌈((4^4)*(4+√.4))⌉\n", - "1187 = ⌊((4+4)!/(4!*√√4))⌋\n", - "1188 = ⌈((4+4)!/(4!*√√4))⌉\n", - "1189 = ⌊(⌈4.4⌉^4.4)⌋\n", - "1190 = ⌈(⌈4.4⌉^4.4)⌉\n", - "1191 = ⌈(√4*((.4+4!)^√4))⌉\n", - "1192 = √4*⌈((.4+4!)^√4)⌉\n", - "1193 = ⌊((√4^(4+√4!))/.4)⌋\n", - "1194 = ⌊(√4!^(√4!-.44))⌋\n", - "1195 = ⌈(√4!^(√4!-.44))⌉\n", - "1196 = ⌊(√4!/(.4^(4!/4)))⌋\n", - "1197 = ⌈(√4!/(.4^(4!/4)))⌉\n", - "1198 = ⌊((4!/(.4^.4))^√4)⌋\n", - "1199 = ⌈((4!/(.4^.4))^√4)⌉\n", - "1200 = 4!*((4!-4)/.4)\n", - "1201 = ⌈((4^4)*√(4!-√4))⌉\n", - "1202 = ⌊((4+(√4!^.4))^4)⌋\n", - "1203 = ⌈((4+(√4!^.4))^4)⌉\n", - "1204 = ⌊(4^(4!/√(4!-√4)))⌋\n", - "1205 = ⌊(4!^(√.4+(.4*4)))⌋\n", - "1206 = ⌈(4!^(√.4+(.4*4)))⌉\n", - "1207 = ⌈((⌈.4⌉+√4!)^4)⌉-4\n", - "1208 = ⌊((.4^-√(4!/.4))-.4)⌋\n", - "1209 = ⌊((4+√(4-.4))^4)⌋\n", - "1210 = ⌈((4+√(4-.4))^4)⌉\n", - "1211 = ⌊(((.4-4!)/4)^4)⌋\n", - "1212 = ⌈(((.4-4!)/4)^4)⌉\n", - "1213 = 4+⌊(.4^-√(4!/.4))⌋\n", - "1214 = 4+⌈(.4^-√(4!/.4))⌉\n", - "1215 = ⌈((4+√.4)^(4+√.4))⌉\n", - "1216 = ⌈(4!^√⌈4.4⌉)⌉-4\n", - "1217 = ⌊(4!^√⌈4.4⌉)⌋-√4\n", - "1218 = ⌊(4.4^√(4!-⌈.4⌉))⌋\n", - "1219 = ⌊(4!^√(4+(4/4)))⌋\n", - "1220 = ⌈(4!^√(4+(4/4)))⌉\n", - "1221 = ⌈(4*(√4!^(4-.4)))⌉\n", - "1222 = √4*⌈(.4^-⌈√44⌉)⌉\n", - "1223 = 4+⌊(4!^√⌈4.4⌉)⌋\n", - "1224 = 4!*⌈(4^√(4+4))⌉\n", - "1225 = ⌈(√.4*(44^√4))⌉\n", - "1226 = ⌈(√(4!-.4)^(√4!-.4))⌉\n", - "1227 = ⌊(4/(.4^(.4^-√4)))⌋\n", - "1228 = ⌈(4/(.4^(.4^-√4)))⌉\n", - "1229 = ⌊((4-(.4^-4))^√4)⌋\n", - "1230 = ⌈((4-(.4^-4))^√4)⌉\n", - "1231 = ⌊((4^√(4!-4))/.4)⌋\n", - "1232 = 44*(4+4!)\n", - "1233 = ⌈((.4-(4/√.4))^4)⌉\n", - "1234 = ⌊(√4!*((4^4)-4))⌋\n", - "1235 = ⌈(√4!*((4^4)-4))⌉\n", - "1236 = (⌈√44⌉!/4)-4!\n", - "1237 = ⌊(4!^(4*(.4^√.4)))⌋\n", - "1238 = ⌈(4!^(4*(.4^√.4)))⌉\n", - "1239 = ⌊(√4!*(4!^(4^.4)))⌋\n", - "1240 = ⌊(.4*(4!^(4*√.4)))⌋\n", - "1241 = ⌈(.4*(4!^(4*√.4)))⌉\n", - "1242 = ⌈(.4*⌈(4!^(4*√.4))⌉)⌉\n", - "1243 = ⌊((4^4)*√(4!-.4))⌋\n", - "1244 = ⌈((4^4)*√(4!-.4))⌉\n", - "1245 = ⌈(√4!*((4^4)-√4))⌉\n", - "1246 = ⌊(((.4+√4!)^4)/√.4)⌋\n", - "1247 = ⌊((4!/.4)^(4^.4))⌋\n", - "1248 = 4!*(4+(4!+4!))\n", - "1249 = ⌊(4^((4!/.4)^.4))⌋\n", - "1250 = √4*(⌈4.4⌉^4)\n", - "1251 = ⌈(√4!*(4^4))⌉-4\n", - "1252 = ⌊(√4!*((4^4)-.4))⌋\n", - "1253 = ⌊((4^.4)*(4!/4)!)⌋\n", - "1254 = (⌈√44⌉!-4!)/4\n", - "1255 = ⌈(.4+(√4!*(4^4)))⌉\n", - "1256 = (⌈√44⌉!/4)-4\n", - "1257 = ⌈(√4!*(.4+(4^4)))⌉\n", - "1258 = 4+⌊(√4!*(4^4))⌋\n", - "1259 = (⌈√44⌉!-4)/4\n", - "1260 = ((4+4!)/4)!/4\n", - "1261 = (4+⌈√44⌉!)/4\n", - "1262 = √4+(⌈√44⌉!/4)\n", - "1263 = ⌊(√4!*(√4+(4^4)))⌋\n", - "1264 = 4+(⌈√44⌉!/4)\n", - "1265 = ⌈((4^4)*√(.4+4!))⌉\n", - "1266 = (4!+⌈√44⌉!)/4\n", - "1267 = ⌊((4*(4+√4!))^√4)⌋\n", - "1268 = ⌊(44^(√4!^.4))⌋\n", - "1269 = ⌈(44^(√4!^.4))⌉\n", - "1270 = ⌈((.4+(.4-√.4))^-4)⌉\n", - "1271 = ⌊(44*(4!+√4!))⌋\n", - "1272 = ((4!/4)^4)-4!\n", - "1273 = ⌊(√4!*(4+(4^4)))⌋\n", - "1274 = ⌈(√4!*(4+(4^4)))⌉\n", - "1275 = ⌈(4!^((.4^-√4)-4))⌉\n", - "1276 = 44*⌈(4!+√4!)⌉\n", - "1277 = ⌊((.4*4!)^√(4/.4))⌋\n", - "1278 = 4!+⌊(√4!*(4^4))⌋\n", - "1279 = 4!+⌈(√4!*(4^4))⌉\n", - "1280 = (4^4)*⌈4.4⌉\n", - "1281 = ⌈(((4+√4!)^4)/√4!)⌉\n", - "1282 = ⌊(4^(√4+√(4/.4)))⌋\n", - "1283 = ⌈(4^(√4+√(4/.4)))⌉\n", - "1284 = 4!+(⌈√44⌉!/4)\n", - "1285 = ⌈((4^√4!)/(.4^.4))⌉\n", - "1286 = ⌈((4!/4)!/(.4^√.4))⌉\n", - "1287 = ⌊(4^(.44^-√4))⌋\n", - "1288 = ⌈(4^(.44^-√4))⌉\n", - "1289 = ⌈(√⌈4.4⌉^(4+√4!))⌉\n", - "1290 = ⌊(((4!^4)/4)^√.4)⌋\n", - "1291 = ⌈(((4!^4)/4)^√.4)⌉\n", - "1292 = ((4!/4)^4)-4\n", - "1293 = ⌈((4+√(.4/4))^√4!)⌉\n", - "1294 = ((4!/4)^4)-√4\n", - "1295 = ⌊(((4!/4)^4)-.4)⌋\n", - "1296 = ((4/.4)-4)^4\n", - "1297 = ⌈.4⌉+((4!/4)^4)\n", - "1298 = √4+((4!/4)^4)\n", - "1299 = ⌈((4*4)^(4-√√4))⌉\n", - "1300 = 4+((4!/4)^4)\n", - "1301 = ⌈(√4!+((4!/4)^4))⌉\n", - "1302 = ⌊(((4^√.4)/.4)^4)⌋\n", - "1303 = ⌈(((4^√.4)/.4)^4)⌉\n", - "1304 = ⌈(√(4+4)^(√4+√4!))⌉\n", - "1305 = ⌊((4^4)*√(4!+√4))⌋\n", - "1306 = ⌈((4^4)*√(4!+√4))⌉\n", - "1307 = ⌈((.4+√√4)*(4!/4)!)⌉\n", - "1308 = 4*⌊((4!/.4)^√√4)⌋\n", - "1309 = ⌊(4!*(4!/.44))⌋\n", - "1310 = ⌈(4!*(4!/.44))⌉\n", - "1311 = ⌊(4!^(4-(4^.4)))⌋\n", - "1312 = ⌊(44^√(4-.4))⌋\n", - "1313 = ⌈(44^√(4-.4))⌉\n", - "1314 = ⌊(4/(.4^(4/√.4)))⌋\n", - "1315 = ⌈(4/(.4^(4/√.4)))⌉\n", - "1316 = ⌈(4^(4!/(4+√.4)))⌉\n", - "1317 = ⌊(4^(√4!+(.4/√√4)))⌋\n", - "1318 = ⌈(4^(√4!+(.4/√√4)))⌉\n", - "1319 = ⌊(√√4/(.4^(4!^√.4)))⌋\n", - "1320 = 4!+((4!/4)^4)\n", - "1321 = ⌊(√(.4+4!)^(√4!-.4))⌋\n", - "1322 = ⌊(4!*((4!/.4)-√4!))⌋\n", - "1323 = ⌈(4!*((4!/.4)-√4!))⌉\n", - "1324 = 4*⌊((√.4-√4!)^4)⌋\n", - "1325 = ⌊((4!-4)^(.4+√4))⌋\n", - "1326 = ⌈((4!-4)^(.4+√4))⌉\n", - "1327 = ⌊(4!^(.4*(4*√√4)))⌋\n", - "1328 = ⌊(((4-.4)^√4!)/.4)⌋\n", - "1329 = ⌈(((4-.4)^√4!)/.4)⌉\n", - "1330 = ⌈((4-.4)^√4!)⌉/.4\n", - "1331 = ⌊((√.4*(4^4))^√√4)⌋\n", - "1332 = ⌈((√.4*(4^4))^√√4)⌉\n", - "1333 = ⌊(√(4/.4)^(.4^-√4))⌋\n", - "1334 = ⌈(√(4/.4)^(.4^-√4))⌉\n", - "1335 = ⌊(4!*(4^(√4!-√4)))⌋\n", - "1336 = ⌊(4.4^√(4!-.4))⌋\n", - "1337 = ⌈(4.4^√(4!-.4))⌉\n", - "1338 = ⌊((4!-4)^(4^√.4))⌋\n", - "1339 = ⌊(4!/(.44^√4!))⌋\n", - "1340 = ⌈(4!/(.44^√4!))⌉\n", - "1341 = ⌊(√4/(.4^(4^√√4)))⌋\n", - "1342 = ⌈(√4/(.4^(4^√√4)))⌉\n", - "1343 = ⌊(4^√⌈(.44^-4)⌉)⌋\n", - "1344 = 4!*((4!/.4)-4)\n", - "1345 = ⌊((.4+(4*√√4))^4)⌋\n", - "1346 = ⌈((.4+(4*√√4))^4)⌉\n", - "1347 = ⌈(((4^.4)/.4)^√4!)⌉\n", - "1348 = ⌈((4+(√√4/4))^√4!)⌉\n", - "1349 = ⌊(4!^(√(4!/.4)^.4))⌋\n", - "1350 = ⌈(4!^(√(4!/.4)^.4))⌉\n", - "1351 = ⌊((4+4)!/(√4^√4!))⌋\n", - "1352 = ⌊(4!/(.4^4.4))⌋\n", - "1353 = ⌈(4!/(.4^4.4))⌉\n", - "1354 = ⌊((4^4)*√(4+4!))⌋\n", - "1355 = ⌈((4^4)*√(4+4!))⌉\n", - "1356 = ⌊((.4+√4!)*(4^4))⌋\n", - "1357 = ⌈((.4+√4!)*(4^4))⌉\n", - "1358 = ⌈(4^(√.4^(.4-4)))⌉\n", - "1359 = ⌈((.4*(√.4*4!))^4)⌉\n", - "1360 = ⌈((√4!^.4)*(4!/4)!)⌉\n", - "1361 = 4+⌈(√⌊(4*√4!)⌋^√4!)⌉\n", - "1362 = ⌊((4*4!)^(√.4/.4))⌋\n", - "1363 = ⌈((4*4!)^(√.4/.4))⌉\n", - "1364 = ⌊((⌊(4!/√.4)⌋^√4)-√4!)⌋\n", - "1365 = ⌊(√4!^(44^.4))⌋\n", - "1366 = ⌈(√4!^(44^.4))⌉\n", - "1367 = ⌈((4!/4)!*√(4-.4))⌉\n", - "1368 = 4!*⌈(.4^-4.4)⌉\n", - "1369 = ⌊(4/((.4-√.4)^4))⌋\n", - "1370 = ⌈(4/((.4-√.4)^4))⌉\n", - "1371 = ⌊(√4!*(4!+(4^4)))⌋\n", - "1372 = 4*⌈((.4-√.4)^-4)⌉\n", - "1373 = ⌊((√4-(.4^-4))^√4)⌋\n", - "1374 = ⌈((√4-(.4^-4))^√4)⌉\n", - "1375 = ⌊(((4^√4!)/4!)^√4)⌋\n", - "1376 = ⌈(((4^√4!)/4!)^√4)⌉\n", - "1377 = ⌈((4!/4)!/(√.4^√√4))⌉\n", - "1378 = ⌊(⌈(.4^-4)⌉^(.4*√4!))⌋\n", - "1379 = ⌊(4^(√4!+√(.4/4)))⌋\n", - "1380 = ((4!*4!)-4!)/.4\n", - "1381 = ⌈((√4!^√4!)/(4^.4))⌉\n", - "1382 = ⌊(4!*(4!*(.4+√4)))⌋\n", - "1383 = ⌈(4!*(4!*(.4+√4)))⌉\n", - "1384 = ⌊(((.4+4!)/4)^4)⌋\n", - "1385 = ⌈(((.4+4!)/4)^4)⌉\n", - "1386 = ⌊((4^4)*(4+√√4))⌋\n", - "1387 = ⌈((4^4)*(4+√√4))⌉\n", - "1388 = ⌈(4^(√44-√√4))⌉\n", - "1389 = ⌈(4!^(√.4*(4-.4)))⌉\n", - "1390 = ⌊(.4/(.4^(4+√4!)))⌋\n", - "1391 = ⌈(.4/(.4^(4+√4!)))⌉\n", - "1392 = 4!*((4!/.4)-√4)\n", - "1393 = ⌈(((.4-4!)^√4)/.4)⌉\n", - "1394 = ⌈((√.4+√⌈(√4^√4!)⌉)^4)⌉\n", - "1395 = ⌊(4.4^√4!)⌋-4!\n", - "1396 = ⌈(4.4^√4!)⌉-4!\n", - "1397 = ⌊(4!^(.4^(4-√4!)))⌋\n", - "1398 = ⌊(4^(4+(√4!/4)))⌋\n", - "1399 = ⌈(4^(4+(√4!/4)))⌉\n", - "1400 = ⌈√44⌉!/(4-.4)\n", - "1401 = ⌊(((4^√4!)-4)/√.4)⌋\n", - "1402 = ⌊((4-.4)^(4*√√4))⌋\n", - "1403 = ⌈((4-.4)^(4*√√4))⌉\n", - "1404 = ⌊(4!^(√4+(4!^-.4)))⌋\n", - "1405 = ⌈(4!^(√4+(4!^-.4)))⌉\n", - "1406 = ⌊((√(4!/4)/.4)^4)⌋\n", - "1407 = ⌈((√(4!/4)/.4)^4)⌉\n", - "1408 = ⌈(4!^((.4^-.4)/√.4))⌉\n", - "1409 = ⌈((.4+(4^√4!))/√.4)⌉\n", - "1410 = ⌊(4!*(4!*√(4!/4)))⌋\n", - "1411 = ⌈(4!*(4!*√(4!/4)))⌉\n", - "1412 = 4+⌈((4^√4!)/√.4)⌉\n", - "1413 = ⌊((4+(4^√4!))/√.4)⌋\n", - "1414 = ⌈((4+(4^√4!))/√.4)⌉\n", - "1415 = ⌊(4.4^√4!)⌋-4\n", - "1416 = 4!*((4!-.4)/.4)\n", - "1417 = ⌊(4.4^√4!)⌋-√4\n", - "1418 = ⌈(4.4^√4!)⌉-√4\n", - "1419 = ⌊((4.4^√4!)-.4)⌋\n", - "1420 = ⌊(.4+(4.4^√4!))⌋\n", - "1421 = ⌈(.4+(4.4^√4!))⌉\n", - "1422 = √4+⌈(4.4^√4!)⌉\n", - "1423 = 4+⌊(4.4^√4!)⌋\n", - "1424 = 4+⌈(4.4^√4!)⌉\n", - "1425 = ⌈(.4*(4*(4^√4!)))⌉\n", - "1426 = ⌈(.4*(4*⌈(4^√4!)⌉))⌉\n", - "1427 = ⌊(((4!*4!)-√4!)/.4)⌋\n", - "1428 = 4*⌈(.4*(4^√4!))⌉\n", - "1429 = ⌈((.4^-√(4!+4!))/.4)⌉\n", - "1430 = ((4!*4!)-4)/.4\n", - "1431 = ⌈(4!*((4!/.4)-.4))⌉\n", - "1432 = √4*((4!/4)!-4)\n", - "1433 = ⌈(4*(4*(4!^√√4)))⌉\n", - "1434 = ⌊(√4!^(4+(4^-.4)))⌋\n", - "1435 = ((4!*4!)-√4)/.4\n", - "1436 = (4!*(4!/.4))-4\n", - "1437 = ⌊(((4!*4!)-⌈.4⌉)/.4)⌋\n", - "1438 = (4!*(4!/.4))-√4\n", - "1439 = ((4!*4!)-.4)/.4\n", - "1440 = (4+4)!/(4+4!)\n", - "1441 = (.4+(4!*4!))/.4\n", - "1442 = √4+(4!*(4!/.4))\n", - "1443 = 4!+⌊(4.4^√4!)⌋\n", - "1444 = 4+(4!*(4!/.4))\n", - "1445 = (√4+(4!*4!))/.4\n", - "1446 = ⌈((4+(4^-√.4))^√4!)⌉\n", - "1447 = ⌈(√(4!-4)^√(4!-.4))⌉\n", - "1448 = √4*(4+(4!/4)!)\n", - "1449 = ⌊(4!*(.4+(4!/.4)))⌋\n", - "1450 = (4+(4!*4!))/.4\n", - "1451 = ⌊(⌊(4!^(.4+√4))⌋/√√4)⌋\n", - "1452 = 44*⌊(4!*√√4)⌋\n", - "1453 = ⌊((4/.4)^√(4/.4))⌋\n", - "1454 = ⌈((4/.4)^√(4/.4))⌉\n", - "1455 = ⌊(4^√(4+(4!-.4)))⌋\n", - "1456 = ⌈(4^√(4+(4!-.4)))⌉\n", - "1457 = ⌊(4*(√.4*(4!*4!)))⌋\n", - "1458 = ⌊((4-√.4)^(4!/4))⌋\n", - "1459 = ⌈((4-√.4)^(4!/4))⌉\n", - "1460 = 4*⌈(√.4*(4!*4!))⌉\n", - "1461 = ⌊((4-⌈.4⌉)^√44)⌋\n", - "1462 = ⌈((4-⌈.4⌉)^√44)⌉\n", - "1463 = ⌈((4*√4!)^√(4!/4))⌉\n", - "1464 = 4!*((.4+4!)/.4)\n", - "1465 = ⌈(4!*(.4+4!))⌉/.4\n", - "1466 = (4!*4!)+⌊(4^√4!)⌋\n", - "1467 = (4!*4!)+⌈(4^√4!)⌉\n", - "1468 = 4!+(⌈(4!/√.4)⌉^√4)\n", - "1469 = ⌊((√4!/.4)*⌈4.4⌉!)⌋\n", - "1470 = ⌊((.4+(4!/√.4))^√4)⌋\n", - "1471 = ⌈((.4+(4!/√.4))^√4)⌉\n", - "1472 = ⌊((4!/(4+√√4))^√4!)⌋\n", - "1473 = ⌊((√.4-.4)^-⌈4.4⌉)⌋\n", - "1474 = ⌊((.4*(4*4!))^√4)⌋\n", - "1475 = ⌈((.4*(4*4!))^√4)⌉\n", - "1476 = ⌊((√.4-(.4^-4))^√4)⌋\n", - "1477 = ⌊(4!*((√.4+4!)/.4))⌋\n", - "1478 = ⌊(4^(4+√(.4*4)))⌋\n", - "1479 = ⌈(4^(4+√(.4*4)))⌉\n", - "1480 = ⌈(4!*(√.4+4!))⌉/.4\n", - "1481 = ⌊(4*(4^(√4!-√.4)))⌋\n", - "1482 = ⌊(4!^((4+4)^.4))⌋\n", - "1483 = ⌈(4!^((4+4)^.4))⌉\n", - "1484 = ⌊(4.44^√4!)⌋\n", - "1485 = ⌈(4.44^√4!)⌉\n", - "1486 = ⌊(4!*(4!+(4!/√.4)))⌋\n", - "1487 = ⌈(4!*(4!+(4!/√.4)))⌉\n", - "1488 = 4!*(√4+(4!/.4))\n", - "1489 = ⌊(.44^-(4+√4!))⌋\n", - "1490 = ⌈(.44^-(4+√4!))⌉\n", - "1491 = ⌈(4!^(√4^(√.4^-.4)))⌉\n", - "1492 = ⌊(4^(.4^-(.4+√√4)))⌋\n", - "1493 = ⌊(4!*(√√4*44))⌋\n", - "1494 = ⌈(4!*(√√4*44))⌉\n", - "1495 = ⌈((.4-(.4^-4))^√4)⌉\n", - "1496 = 4*⌊(4.4^4)⌋\n", - "1497 = (⌊(.4^-4)⌋^√4)-4!\n", - "1498 = ⌊((4*44)^√√4)⌋\n", - "1499 = ⌊(4*(4.4^4))⌋\n", - "1500 = 4*⌈(4.4^4)⌉\n", - "1501 = ⌊(.4^-(4+4))⌋-4!\n", - "1502 = ⌈(.4^-(4+4))⌉-4!\n", - "1503 = ⌈((√4!^√4!)/(.4*4))⌉\n", - "1504 = ⌈(√4!/(.4^(.4^-√4)))⌉\n", - "1505 = ⌊(4^(4*(√4^.4)))⌋\n", - "1506 = ⌈(4^(4*(√4^.4)))⌉\n", - "1507 = ⌊((.4+√⌈(4!*√√4)⌉)^4)⌋\n", - "1508 = ⌊(4.4^√(.4+4!))⌋\n", - "1509 = ⌊((.4-√44)^4)⌋\n", - "1510 = ⌈((.4-√44)^4)⌉\n", - "1511 = ⌈((4^4)*(⌈.4⌉+√4!))⌉\n", - "1512 = 4!*⌈(√√4*44)⌉\n", - "1513 = ⌊(4!*(4!+(.4^-4)))⌋\n", - "1514 = ⌈(4!*(4!+(.4^-4)))⌉\n", - "1515 = ⌊((√4!-.44)^√4!)⌋\n", - "1516 = ⌈((√4!-.44)^√4!)⌉\n", - "1517 = (⌊(.4^-4)⌋^√4)-4\n", - "1518 = ⌊(√.4*(⌈√44⌉^4))⌋\n", - "1519 = ⌊((.4-(.4^√.4))^-4)⌋\n", - "1520 = ⌊((.4^-(4+4))-√4!)⌋\n", - "1521 = ⌊(.4^-(4+4))⌋-4\n", - "1522 = ⌈(.4^-(4+4))⌉-4\n", - "1523 = ⌊(.4^-(4+4))⌋-√4\n", - "1524 = ⌈(.4^-(4+4))⌉-√4\n", - "1525 = ⌊(.4^((4*4)-4!))⌋\n", - "1526 = ⌈(.4^((4*4)-4!))⌉\n", - "1527 = ⌈(.4+(.4^-(4+4)))⌉\n", - "1528 = √4+⌈(.4^-(4+4))⌉\n", - "1529 = 4+⌊(.4^-(4+4))⌋\n", - "1530 = 4+⌈(.4^-(4+4))⌉\n", - "1531 = ⌈(√4!+(.4^-(4+4)))⌉\n", - "1532 = ⌈(4^√(4+4!))⌉-√4\n", - "1533 = ⌊((4^√(4+4!))-.4)⌋\n", - "1534 = ⌊(.4+(4^√(4+4!)))⌋\n", - "1535 = ⌈(.4+(4^√(4+4!)))⌉\n", - "1536 = 4*(4*(4*4!))\n", - "1537 = 4+⌊(4^√(4+4!))⌋\n", - "1538 = 4+⌈(4^√(4+4!))⌉\n", - "1539 = ⌈(√4!+(4^√(4+4!)))⌉\n", - "1540 = ⌈(4^(4+√.4))⌉/.4\n", - "1541 = 4+⌊(√(4!-4)^√4!)⌋\n", - "1542 = 4+⌈(√(4!-4)^√4!)⌉\n", - "1543 = ⌈((√.4-(√4+√4!))^4)⌉\n", - "1544 = √4*⌈(4^√(4!-⌈.4⌉))⌉\n", - "1545 = ⌊(4^(.4+√4!))⌋-4\n", - "1546 = ⌈(4^(.4+√4!))⌉-4\n", - "1547 = ⌊(4^(.4+√4!))⌋-√4\n", - "1548 = ⌊((4!+4!)^√(4-.4))⌋\n", - "1549 = 4!+⌊(.4^-(4+4))⌋\n", - "1550 = 4!+⌈(.4^-(4+4))⌉\n", - "1551 = ⌈((4+4)!/(4!+√4))⌉\n", - "1552 = √4+⌈(4^(.4+√4!))⌉\n", - "1553 = 4+⌊(4^(.4+√4!))⌋\n", - "1554 = 4+⌈(4^(.4+√4!))⌉\n", - "1555 = ⌈(√4!+(4^(.4+√4!)))⌉\n", - "1556 = ⌈(4!*((4!-√4!)^√√4))⌉\n", - "1557 = ⌊((4+4)!^(.4^.4))⌋\n", - "1558 = ⌈((4+4)!^(.4^.4))⌉\n", - "1559 = ⌊((4+4)^(√√4/.4))⌋\n", - "1560 = 4!*((4!+√4)/.4)\n", - "1561 = 4!+⌊(√(4!-4)^√4!)⌋\n", - "1562 = ⌊((⌈4.4⌉^4)/.4)⌋\n", - "1563 = ⌈((⌈4.4⌉^4)/.4)⌉\n", - "1564 = ⌊((√.4+(4*√√4))^4)⌋\n", - "1565 = ⌈((√.4+(4*√√4))^4)⌉\n", - "1566 = ⌊((⌈.4⌉+√(4+4!))^4)⌋\n", - "1567 = ⌊(((4+√4!)^4)/4)⌋\n", - "1568 = √4*((4+4!)^√4)\n", - "1569 = ⌊(√4!^(4+√.4))⌋-4\n", - "1570 = ⌈(√4!^(4+√.4))⌉-4\n", - "1571 = ⌊((√.4-√(4!+4!))^4)⌋\n", - "1572 = ⌈((√.4-√(4!+4!))^4)⌉\n", - "1573 = 4!+⌊(4^(.4+√4!))⌋\n", - "1574 = 4!+⌈(4^(.4+√4!))⌉\n", - "1575 = ⌊((√4!^√44)/4!)⌋\n", - "1576 = ((4/√.4)^4)-4!\n", - "1577 = 4+⌊(√4!^(4+√.4))⌋\n", - "1578 = 4+⌈(√4!^(4+√.4))⌉\n", - "1579 = ⌊((√4!-.4)^√4!)⌋-4\n", - "1580 = ⌈((√4!-.4)^√4!)⌉-4\n", - "1581 = ⌈((4^(√4!+√√4))/4)⌉\n", - "1582 = ⌈((√4!-.4)^√4!)⌉-√4\n", - "1583 = ⌊((√4+√√4)^(4!/4))⌋\n", - "1584 = 4!*⌊(4!^(√4^.4))⌋\n", - "1585 = ⌊((4+(√4/4))^√4!)⌋\n", - "1586 = ⌈((4+(√4/4))^√4!)⌉\n", - "1587 = ⌊(√(.4/4!)^(.4-4))⌋\n", - "1588 = ⌈(√(.4/4!)^(.4-4))⌉\n", - "1589 = ⌊(((4*4!)^√√4)/.4)⌋\n", - "1590 = ⌊(4!*(4!^(√4^.4)))⌋\n", - "1591 = ⌈(4!*(4!^(√4^.4)))⌉\n", - "1592 = 4+⌊((√4!+√√4)^4)⌋\n", - "1593 = ⌊(.4^-(√√4+√44))⌋\n", - "1594 = ⌊(4^(4+(√4^.4)))⌋\n", - "1595 = ⌈(4^(4+(√4^.4)))⌉\n", - "1596 = ((4/√.4)^4)-4\n", - "1597 = 4!+⌊(√4!^(4+√.4))⌋\n", - "1598 = ((4/√.4)^4)-√4\n", - "1599 = ⌊(((4/√.4)^4)-.4)⌋\n", - "1600 = (4-44)^√4\n", - "1601 = ⌈.4⌉+((4/√.4)^4)\n", - "1602 = √4+((4/√.4)^4)\n", - "1603 = ⌈(4^(√.4+√(4!-√4)))⌉\n", - "1604 = 4+((4/√.4)^4)\n", - "1605 = ⌊((4^(4/√.4))/4)⌋\n", - "1606 = ⌈(4^(4/√.4))⌉/4\n", - "1607 = ⌊((√√4-√(4!/.4))^4)⌋\n", - "1608 = 4!*⌊(4!*√(4+4))⌋\n", - "1609 = ⌊(√⌈4.4⌉*(4!/4)!)⌋\n", - "1610 = (4!/4)!+⌊(4^√4!)⌋\n", - "1611 = (4!/4)!+⌈(4^√4!)⌉\n", - "1612 = 4*⌊(4!^(√4!^.4))⌋\n", - "1613 = ⌈((4+4)!/(⌈.4⌉+4!))⌉\n", - "1614 = ⌊(4*(4!^(√4!^.4)))⌋\n", - "1615 = ⌊(4!^((4/√.4)-4))⌋\n", - "1616 = ⌊(4^√(4!+4.4))⌋\n", - "1617 = ⌈(4^√(4!+4.4))⌉\n", - "1618 = ⌈(.44^⌈(.4*-4!)⌉)⌉\n", - "1619 = ⌊(4*((4^4)/√.4))⌋\n", - "1620 = 4*⌈((4^4)/√.4)⌉\n", - "1621 = ⌊(√.4*(√4!^√(.4+4!)))⌋\n", - "1622 = ⌊((4!/4)^√4!)⌋/4\n", - "1623 = ⌈(((4!/4)^√4!)/4)⌉\n", - "1624 = 4!+((4/√.4)^4)\n", - "1625 = ⌊((4*√√4)^(√4!-√.4))⌋\n", - "1626 = ⌈((4*√√4)^(√4!-√.4))⌉\n", - "1627 = ⌈(⌈√44⌉!/(√.4*√4!))⌉\n", - "1628 = 44*⌊(4!/√.4)⌋\n", - "1629 = ⌊(4!*(4!*√(4+4)))⌋\n", - "1630 = ⌈(4!*(4!*√(4+4)))⌉\n", - "1631 = ⌊(4^(4+(√.4^-√.4)))⌋\n", - "1632 = 4!*(4!+44)\n", - "1633 = ⌈((.4+⌈(.4^-4)⌉)^√4)⌉\n", - "1634 = ⌊(√(.4+4!)^(4+√.4))⌋\n", - "1635 = ⌊((4!^√(4+4))/√4!)⌋\n", - "1636 = ⌊((4!/4)!/.44)⌋\n", - "1637 = ⌈((4!/4)!/.44)⌉\n", - "1638 = ⌊(.4*((4+4)^4))⌋\n", - "1639 = ⌈(.4*((4+4)^4))⌉\n", - "1640 = 4*⌈((.4-√4!)^4)⌉\n", - "1641 = ⌈((⌊(.4*4!)⌋^4)/4)⌉\n", - "1642 = ⌈(√4!^(√(4+4!)-√.4))⌉\n", - "1643 = ⌊((√.4-⌈√44⌉)^4)⌋\n", - "1644 = ⌈((√.4-⌈√44⌉)^4)⌉\n", - "CPU times: user 1min 12s, sys: 77.8 ms, total: 1min 12s\n", - "Wall time: 1min 12s\n" + "CPU times: user 57.5 s, sys: 181 ms, total: 57.6 s\n", + "Wall time: 57.7 s\n" ] } ], "source": [ - "%time show((4, 4, 4, 4), ops=OPS + \"⌊⌈\")" + "%time show((4, 4, 4, 4), limit=100, ops=OPS + \"⌊⌈\")" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "4isEhtVGKEBC", + "tags": [] + }, "source": [ - "We could get up to 2892 with `show((4, 4, 4, 4), ops=OPS + \"⌊⌈\", nesting_level=3)`.\n", + "We could get up to 2892 with `show((4, 4, 4, 4), ops=OPS + \"⌊⌈\", nesting=3)`.\n", "\n", "# Even More Fives: Five 5s\n", "\n", - "In the [xkcd forum](http://forums.xkcd.com/viewtopic.php?f=14&t=116813&start=280) they took up the problem of **five 5s** and got all the integers up to 298, using the \"double factorial\" and π functions. We can get up to 171, using just the default operators, but with five digits it does take about seven minutes, whereas all the other puzzles with four or three digits (and without floor and ceiling) took less than a minute. I suspect you could go much further using floor and ceiling, but that computation would take even longer, so for now let's stick with our default set of operations:" + "In the [xkcd forum](http://forums.xkcd.com/viewtopic.php?f=14&t=116813&start=280) they took up the problem of **five 5s** and got all the integers up to 298, using the \"[double factorial function](https://en.wikipedia.org/wiki/Double_factorial)\" and [π function](https://en.wikipedia.org/wiki/Prime-counting_function). We can get up to 171, using just the default operators, but with five digits it does take about seven minutes, whereas all the other puzzles with four or three digits (and without floor and ceiling) took less than a minute. I suspect you could go much further using floor and ceiling, but that computation would take even longer, so for now let's stick with our default set of operations:" ] }, { "cell_type": "code", - "execution_count": 42, - "metadata": {}, + "execution_count": 44, + "metadata": { + "id": "4MHPG5L8KEBC", + "outputId": "63bffec7-8b22-4bb2-cd44-6fd03f124ccf" + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Can make 0 to 171 with expressions((5, 5, 5, 5, 5), ops=\"+-*/^_√!.&\"). [14,809,921 table entries]\n", + "Can make 0 to 171 with expressions((5, 5, 5, 5, 5), ops=\"+-*/^_√!.,\", permute=False). [14,809,921 table entries]\n", "\n", " 0 = 5*(55-55)\n", " 1 = 5^(55-55)\n", - " 2 = 55/(.5*55)\n", + " 2 = 55/(5*5.5)\n", " 3 = .5*((55/5)-5)\n", " 4 = 5-(55/55)\n", " 5 = 5+(55-55)\n", @@ -3408,7 +2071,7 @@ " 24 = (5-(55/55))!\n", " 25 = 55-(5+(5*5))\n", " 26 = 5*(5+(5/(5*5)))\n", - " 27 = 5+(55/(.5*5))\n", + " 27 = 5+(55/(5*.5))\n", " 28 = .5*(55+(5/5))\n", " 29 = 5+((5*5)-(5/5))\n", " 30 = 5*((55/5)-5)\n", @@ -3419,7 +2082,7 @@ " 35 = 5+(55-(5*5))\n", " 36 = (5*5)+(55/5)\n", " 37 = 5+((5.5-5)^-5)\n", - " 38 = .5+(5*(5+(.5*5)))\n", + " 38 = 5+(.5*(5!*.55))\n", " 39 = ((5*5)-5.5)/.5\n", " 40 = 55-(5+(5+5))\n", " 41 = (5!*.55)-(5*5)\n", @@ -3433,18 +2096,18 @@ " 49 = 55-(5+(5/5))\n", " 50 = 55.5-5.5\n", " 51 = 55+((5/5)-5)\n", - " 52 = 55-(.5+(.5*5))\n", + " 52 = 55-(.5+(5*.5))\n", " 53 = 55-((5+5)/5)\n", " 54 = ((5*55)-5)/5\n", " 55 = .5*(55+55)\n", " 56 = (5+(5*55))/5\n", " 57 = 55+((5+5)/5)\n", - " 58 = (.5*5)+55.5\n", + " 58 = (5*.5)+55.5\n", " 59 = 5+(55-(5/5))\n", " 60 = 5+(5+(55-5))\n", " 61 = 5.5+55.5\n", " 62 = (55-(5!/5))/.5\n", - " 63 = .5+(.5*(5*(5*5)))\n", + " 63 = .5+(5*(5*(5*.5)))\n", " 64 = .5^(5-(55/5))\n", " 65 = 5+(5!-(5+55))\n", " 66 = 55+(55/5)\n", @@ -3454,7 +2117,7 @@ " 70 = 5+(5+(5+55))\n", " 71 = 55+(.5/(.5^5))\n", " 72 = (5+(5/5))!/(5+5)\n", - " 73 = (5*5)+(5!/(.5*5))\n", + " 73 = (5*5)+(5!/(5*.5))\n", " 74 = 55+((5!/5)-5)\n", " 75 = 55+((5*5)-5)\n", " 76 = 5+(5+(5!*.55))\n", @@ -3474,17 +2137,17 @@ " 90 = (55-(5+5))/.5\n", " 91 = (5*5)+(5!*.55)\n", " 92 = 5+(55+(.5^-5))\n", - " 93 = .5+(5!-(.5*55))\n", + " 93 = .5+(5!-(5*5.5))\n", " 94 = 5!-((5/5)+(5*5))\n", " 95 = (55/.55)-5\n", " 96 = 5!+((5/5)-(5*5))\n", " 97 = 5!+((.5^-5)-55)\n", - " 98 = 5!-(55/(.5*5))\n", + " 98 = 5!-(55/(5*.5))\n", " 99 = (55-5.5)/.5\n", " 100 = (55/.5)-(5+5)\n", " 101 = (55.5-5)/.5\n", " 102 = (.5+(5*5))/(.5*.5)\n", - " 103 = 55+(5!/(.5*5))\n", + " 103 = 55+(5!/(5*.5))\n", " 104 = 5!-(5+(55/5))\n", " 105 = 55+(55-5)\n", " 106 = (555/5)-5\n", @@ -3506,7 +2169,7 @@ " 122 = 5!+(5!/(5+55))\n", " 123 = 5!+((5+(5+5))/5)\n", " 124 = (5*(5*5))-(5/5)\n", - " 125 = .5*(5*(55-5))\n", + " 125 = 5*(.5*(55-5))\n", " 126 = (5/5)+(5*(5*5))\n", " 127 = (5!*(5.5/5))-5\n", " 128 = (5-(5/5))/(.5^5)\n", @@ -3518,18 +2181,18 @@ " 134 = (5!/5)+(55/.5)\n", " 135 = (5!+555)/5\n", " 136 = 5+(5!+(55/5))\n", - " 137 = (.5*(5*55))-.5\n", - " 138 = .5+(.5*(5*55))\n", + " 137 = (5*(5*5.5))-.5\n", + " 138 = .5+(5*(5*5.5))\n", " 139 = ((5+(5/5))!/5)-5\n", " 140 = .5*(5+(5*55))\n", " 141 = 5!+((5+5.5)/.5)\n", - " 142 = 5!+(55/(.5*5))\n", + " 142 = 5!+(55/(5*.5))\n", " 143 = ((5+(5/5))!-5)/5\n", " 144 = ((55/5)-5)!/5\n", " 145 = (5*(5+(5*5)))-5\n", " 146 = 5!+((5/5)+(5*5))\n", - " 147 = 5!+((.5*55)-.5)\n", - " 148 = .5+(5!+(.5*55))\n", + " 147 = 5!+((5*5.5)-.5)\n", + " 148 = .5+(5!+(5*5.5))\n", " 149 = (5!/5)+(5*(5*5))\n", " 150 = 5*(55-(5*5))\n", " 151 = 5!+(55-(5!/5))\n", @@ -3547,14 +2210,14 @@ " 163 = .5+(5*(.5+(.5^-5)))\n", " 164 = 5!+(.5*(5!-(.5^-5)))\n", " 165 = 55+(55/.5)\n", - " 166 = 5!+((5!-5)/(.5*5))\n", + " 166 = 5!+((5!-5)/(5*.5))\n", " 167 = 5!+(((5!/.5)-5)/5)\n", " 168 = (5!+(5+(5/5))!)/5\n", " 169 = 5!+((5*5)+(5!/5))\n", " 170 = 5!+((5*5)+(5*5))\n", " 171 = (5.5/(.5^5))-5\n", - "CPU times: user 10min 54s, sys: 1.01 s, total: 10min 55s\n", - "Wall time: 11min\n" + "CPU times: user 8min 36s, sys: 2.01 s, total: 8min 38s\n", + "Wall time: 8min 39s\n" ] } ], @@ -3564,7 +2227,59 @@ }, { "cell_type": "markdown", + "metadata": { + "id": "9HYipLxUKEBC" + }, + "source": [ + "# f(n): Unmakeable from (1, ..., *n*)\n", + "\n", + "The facebook group \"actually good math problems\" posed the problem of determining the values of `f(n)`, which is defined to be the smallest positive integer that can not be made from, in our terms, `expressions(range(n + 1), '+-*/^,', permute=True)`. Computing up to `f(5)` is fast, but `f(6)` requires humdreds of billions of combinations and 100 minutes to run; it would take some work to make it more efficient." + ] + }, + { + "cell_type": "code", + "execution_count": 45, "metadata": {}, + "outputs": [], + "source": [ + "@cache\n", + "def f(n, ops='+-*/^,') -> int:\n", + " \"\"\"The smallest integer inexpressible in digits 0 thru n.\"\"\"\n", + " return unmakeable(expressions(range(n + 1), ops, permute=True))" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(0) = 1\n", + "f(1) = 2\n", + "f(2) = 4\n", + "f(3) = 25\n", + "f(4) = 175\n", + "f(5) = 1099\n", + "f(6) = 9562\n", + "CPU times: user 1h 40min 15s, sys: 11.3 s, total: 1h 40min 26s\n", + "Wall time: 1h 42min 44s\n" + ] + } + ], + "source": [ + "%%time\n", + "for n in range(7):\n", + " print(f'f({n}) = {f(n)}')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "9HYipLxUKEBC" + }, "source": [ "# What's Next?\n", "\n", @@ -3577,7 +2292,8 @@ "- **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", "- **Prime counting function**: `π(n)` = number of primes ≲ n; e.g. `π(5)` = 3\n", - "- **Transcendental functions**: `log`, `sin` `cos`, `tan`, `arcsin`, ... maybe degree symbol: 90°\n", + "- **Transcendental functions**: `log`, `sin` `cos`, `tan`, `arcsin`, ... maybe \n", + "- **Degree symbol**: `180°` = π\n", "- **Log to base**: `log_10(100)` = 2\n", "- **Matrix notation**: with determinant symbol to get a number.\n", "- **Combinations and Permutations**: `n P k` and `n C k`\n", @@ -3587,8 +2303,11 @@ } ], "metadata": { + "colab": { + "provenance": [] + }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -3602,7 +2321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.6" + "version": "3.8.15" } }, "nbformat": 4,