5
$\begingroup$

I would like to find all the expressions that can be created using nothing but arithmetic operators, exactly eight $8$'s, and parentheses.

Here are the seven solutions I've found (on the Internet) so far:

\begin{align} 1000 &= (8888 - 888) / 8\\ 1000 &= 888 + 88 + 8 + 8 + 8\\ 1000 &= 888 + 8 \cdot (8 + 8) - 8 - 8\\ 1000 &= 8 \cdot (8 \cdot 8 + 8 \cdot 8) - 8 - 8 - 8\\ 1000 &= 8 \cdot (8 \cdot (8 + 8) - (8 + 8) / 8) - 8\\ 1000 &= (8 \cdot (8 + 8) - (8 + 8 + 8) / 8) \cdot 8\\ 1000 &= (8 \cdot (8 + 8) - 88 / 8 + 8) \cdot 8 \end{align}

Are there others, and if there are, what are they?

Update

After sifting through achille hui's answer and adding one of mathlove's solutions, I get the following $16$ possibilities:

\begin{align} 1000 &= (8888 - 888)/8\\ 1000 &= 888 + (888 + 8)/8\\ 1000 &= 888 + 88 + 8 + 8 + 8\\ 1000 &= 888 + (8 + 8) \cdot (8 - 8/8)\\ 1000 &= 888 - (8 + 8) \cdot (8/8 - 8)\\ 1000 &= 888 + 8 \cdot (8 + 8) - 8 - 8\\ 1000 &= (888 \cdot (8/8 + 8) + 8)/8\\ 1000 &= 8 \cdot (8 - 88/8 + 8 \cdot (8 + 8))\\ 1000 &= 8 \cdot 8 - 88 + 8 \cdot 8 \cdot (8 + 8)\\ 1000 &= 8 \cdot 8 \cdot (8 + 8 - 8/(8 + 8)) + 8\\ 1000 &= 8 \cdot (8 \cdot 8 + 8 \cdot 8) - 8 - 8 - 8\\ 1000 &= 8 \cdot (8 \cdot (8 + 8) - 8/8) - 8 - 8\\ 1000 &= 8 - 8 \cdot (8 \cdot (8/(8 + 8) - 8 - 8))\\ 1000 &= (8 - 8/(8 \cdot 8)) \cdot (8 + 8) \cdot 8 - 8\\ 1000 &= (8\cdot 8\cdot 8-8)\cdot (8+8)/8-8\\ 1000 &= (8 + 8) \cdot (8 \cdot 8 - (8 + 8)/8) + 8 \end{align}

If any of these are equivalent, please let me know.

$\endgroup$
  • $\begingroup$ Are only the four basic arithmetical operations plus parentheses permitted? $\endgroup$ – Brian Tung May 24 '16 at 22:13
  • $\begingroup$ Do you count variations as different? For example, $1000=8+8+88+888+8$ It can be hard to define what expressions are the same if not. $\endgroup$ – Ross Millikan May 24 '16 at 22:14
  • $\begingroup$ @BrianTung Yes. $\endgroup$ – Svend Tveskæg May 24 '16 at 22:16
  • $\begingroup$ If we allow exponentiation, there are others, such as $\frac{88-8}{8}$ to the power $\frac{8+8+8}{8}$. $\endgroup$ – André Nicolas May 24 '16 at 22:16
  • 1
    $\begingroup$ You $10^{th}$ and $11^{th}$ expression is equivalent to each other. Based on your list, I think some expressions on my list is actually equivalent to each other. There are still some mismatches, I'll revisit them later. $\endgroup$ – achille hui May 29 '16 at 20:18
6
+50
$\begingroup$

By brute force, if order of parentheses matter ( i.e. expression like $(8+8)+8$ is considered to be distinct from $8+(8+8)$), I have counted $623$ solutions.

Since I don't have a clean cut criterion to tell which solutions are equivalent when we unwind the parentheses, I cooked up some ad hoc hash function to classify the $623$ solutions. Under this classification, solutions with different number of operators are considered to be distinct. The result is a list of $23$ expressions.

To proceed further, we replace the appearance of $8, 88, 888, 8888$ in these expressions by 4 variables $x_1, x_2, x_3, x_4$ and ask an CAS to simplify them. Based on the result, we split the $23$ expressions into $7$ groups.

(x4-x3)/x1
1   #  ( ( 8888 - 888 ) / 8 )

((x1+1)*x3+x1)/x1
2   #a ( ( ( 8 + 888 ) / 8 ) + 888 )
3   #b ( ( ( 888 * ( ( 8 / 8 ) + 8 ) ) + 8 ) / 8 )

x3+x2+3*x1
4   #  ( 8 + ( 8 + ( 8 + ( 88 + 888 ) ) ) )

x3+2*x1^2-2*x1
5   #a ( 888 + ( ( 8 * ( 8 + 8 ) ) - ( 8 + 8 ) ) )
6   #a ( 888 - ( ( 8 - ( 8 * ( 8 + 8 ) ) ) + 8 ) )
7   #a ( ( 888 - 8 ) - ( 8 - ( 8 * ( 8 + 8 ) ) ) )
8   #b ( 888 + ( ( 8 - ( 8 / 8 ) ) * ( 8 + 8 ) ) )
9   #b ( 888 - ( ( ( 8 / 8 ) - 8 ) * ( 8 + 8 ) ) )

-x2+2*x1^3+x1^2
10  #a ( ( ( 8 * 8 ) - 88 ) + ( 8 * ( 8 * ( 8 + 8 ) ) ) )
11  #a ( ( 8 * 8 ) - ( 88 - ( 8 * ( 8 * ( 8 + 8 ) ) ) ) )
12  #b ( 8 * ( ( 8 - ( 88 / 8 ) ) + ( 8 * ( 8 + 8 ) ) ) )
13  #b ( 8 * ( 8 - ( ( 88 / 8 ) - ( 8 * ( 8 + 8 ) ) ) ) )

(4*x1^3-x1^2+2*x1)/2
14  #  ( ( 8 * ( 8 * ( ( 8 - ( 8 / ( 8 + 8 ) ) ) + 8 ) ) ) + 8 )
15  #  ( ( 8 * ( 8 * ( 8 - ( ( 8 / ( 8 + 8 ) ) - 8 ) ) ) ) + 8 )
16  #  ( 8 - ( 8 * ( 8 * ( ( ( 8 / ( 8 + 8 ) ) - 8 ) - 8 ) ) ) )

2*x1^3-3*x1
17  #a ( ( 8 * ( ( 8 * 8 ) + ( 8 * 8 ) ) ) - ( 8 + ( 8 + 8 ) ) )
18  #a ( ( ( ( 8 * ( ( 8 * 8 ) + ( 8 * 8 ) ) ) - 8 ) - 8 ) - 8 )
19  #a ( ( ( 8 * ( ( 8 * 8 ) + ( 8 * 8 ) ) ) - 8 ) - ( 8 + 8 ) )
20  #b ( ( ( ( 8 * 8 ) - ( ( 8 + 8 ) / 8 ) ) * ( 8 + 8 ) ) + 8 )
21  #b ( ( ( ( 8 * ( 8 + 8 ) ) - ( 8 / 8 ) ) * 8 ) - ( 8 + 8 ) )
22  #c ( ( ( 8 - ( 8 / ( 8 * 8 ) ) ) * ( 8 * ( 8 + 8 ) ) ) - 8 )
23  #d ( ( ( 8 - ( ( 8 / 8 ) / 8 ) ) * ( 8 * ( 8 + 8 ) ) ) - 8 )

Expressions in different group are definitely in-equivalent. Within a group, some expressions looks so different, we should really treat them as distinct. e.g.

  • expression 2 and 3 above has different number of variables
  • expression 7 doesn't involves division while expression 8 does.

Once again, I have to emphasis I don't have a clean cut criterion to tell which expressions are equivalent. I will leave the 23 expressions as is and let you make your own judgement.

$\endgroup$
  • $\begingroup$ See updated question. $\endgroup$ – Svend Tveskæg May 29 '16 at 19:01
  • $\begingroup$ In my judgement, none of your solutions is equivalent to the first example in my answer, which surprised me a lot :) $\endgroup$ – mathlove May 30 '16 at 7:42
  • 1
    $\begingroup$ @mathlove, I have looked at that expression before, it belongs to the $7^{th}$ group "2x_1^3-3x_1" but you are right that they didn't look equivalent. In the absence of a clean criterion what is considered to be equivalent, let us settle we get different answers. $\endgroup$ – achille hui May 30 '16 at 7:56
5
$\begingroup$

Are there others

Yes :

$$1000=(8\cdot 8\cdot 8-8)\cdot (8+8)/8-8$$

Added :

$$1000=(8+8)\cdot (8\cdot 8-(8+8)/8)+8$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.