25

Make the number 1998 using the minimum amount of digits 8.

Your allowed operations are +, -, *, /, ^, % (percent).

You need not use only integers 8: 88 and the likes are acceptable.

You must only use 8 as a digit, nothing else.

This puzzle comes from an old friend's school DMs. He said the best that could be done was 10, so I'm turning to the community to see if you can do it better.

Have fun.

bobble
  • 10,245
  • 4
  • 32
  • 80
Andrew
  • 795
  • 7
  • 13
  • Can we write two eights together to make 88? – Bass Sep 11 '19 at 17:02
  • @Andrew Viola! We have got it with 9 8's (by @HerbWolfe) – Quark-epoch Sep 11 '19 at 17:31
  • 2
    @Quark-epoch I got a nine-$8$ solution around 15 minutes before Herb Wolfe :-) – Rand al'Thor Sep 11 '19 at 17:58
  • The real question is, what about 8 8s? – Andrew Sep 11 '19 at 17:59
  • 2
    Adding concatenation really does change the question. – Ben Barden Sep 11 '19 at 18:31
  • @BenBarden agreed, but as of yet, there's no evidence of it also changing the answer :-) – Bass Sep 11 '19 at 21:18
  • @Bass If we allow proper concatenation, it will definitely change the answer :) E.g. 888/8 * concat(8/8, 8) = 111 * concat(1, 8) = 111 * 18 = 1998. – trolley813 Sep 12 '19 at 08:53
  • What is 8: 88? Colon is not defined as a valid operator, did you mean 8.88 (as in 888 / 100)? Also, it doesn't look like you're limiting the numbers we can use. Does that mean 1999 - 1 is a valid answer? I know the question implies only 8s, but I see no attempt to prevent this particular loophole. – Nolonar Sep 12 '19 at 13:51
  • @Nolonar 8:88 is not a number; it means that we may use integers other than 8, such as 88 and so on. – Rand al'Thor Sep 12 '19 at 14:06
  • @Nolonar I guess he was saying that you don't have to only use integer equal to 8. The colon is here to point to the example after it. – Zoma Sep 12 '19 at 14:08
  • According to this consensus on meta, these types of questions must have a provably optimized answer. It may be the case that the only valid answers are brute-force computer searches. To answerers: Answers must have a proof of optimality. An answer without a proof of optimality is a comment, not an answer. – Deusovi Sep 13 '19 at 05:27
  • @Deusovi - Did... you just delete all the answers? O_O – Vilx- Sep 13 '19 at 07:25
  • 1
    @Deusovi - Also, if so, then my answer should probably go too, because I do not have a proof of optimality either. I searched a pretty large set of expressions, but there's an infinity of possibilities and the data types used don't fare so well with extreme numbers. There was already one answer (with 1875 % signs) that would be impossible for my code to find. – Vilx- Sep 13 '19 at 07:35
  • I've temporarily locked this question due to concerns about answer validity and how the question falls under this meta post - see this discussion in The Sphinx's Lair for more details. – Deusovi Sep 13 '19 at 08:34

12 Answers12

32

Found a solution with 8 eights, using concatenation and finally finding some use for the percent sign:

$$\frac{88 + 8\times8 +8 -8\% -8\%}{8\%}$$ $$ = \frac{88 + 64 + 8 -.08 -.08}{.08} = \frac{160}{.08} - \frac{.08}{.08}- \frac{.08}{.08} = 160*12.5 -2 = 1998$$

EDITED (much later..): Found another, without concatenation this time:

$$8 \times (8+8) \times (8+8) - \frac{8}{8\%+8\%} $$ $$ = 8\times16\times16 - \frac{8}{.16} = 2048 - 50 = 1998 $$

Bass
  • 77,343
  • 8
  • 173
  • 360
  • After checking the other answers, I'd like to add a particularly smug wave (Hi there!) to Rand's first answer in particular :-) – Bass Sep 11 '19 at 18:53
  • Darn you beat me to your second solution! :P (my 9 solution is a derpy way to do yours) – Adam Sep 11 '19 at 19:37
  • 2
    @Adam, I totally stole the way to make the 50 from your post, the unusual use of the parens and the percent sign caught my eye, and I realised you had invented a totally brilliant way of creating the 50 I remembered desperately needing an hour ago. (The upvote on your answer is mine, more would definitely be in order.) – Bass Sep 11 '19 at 19:48
  • Ah, damn, I was so close. Well done. – Rand al'Thor Sep 11 '19 at 20:50
  • +1 for managing to pull it off without concatenation. Well done! – Ben Barden Sep 11 '19 at 21:25
  • 5
    At the time this comment was sent, there were 8 upvotes on the question, 8 upvotes on the answer, 8 8's used to create this answer, and 8 answers. – sunfishho Sep 11 '19 at 22:14
  • 2
    You did it. You're a legend. – Andrew Sep 12 '19 at 13:02
  • 1
    @Andrew Oh, you flatter me. I'm not a legend, I'm only epic. :-) – Bass Sep 12 '19 at 13:42
  • Based on the rules established by this meta post and the consensus around it, an answer must have justification for why the solution is optimal. Without that, this is a comment, not an answer. – Deusovi Sep 13 '19 at 05:27
  • 8
    @Deusovi sorry, but how exactly do you think such a proof can be accomplished??? I literally do not think such a proof (in the mathematical sense) is possible given the infinitude of possibilities. – YiFan Sep 13 '19 at 12:48
20

OK, so I took a different approach. Seeing as I couldn't come up with anything interesting, I decided - f-it, let's make the computer try! And wrote a little program that tries all the possibilities. The code can be found here on PasteBin.

There are two things of note about the % operator:

  • I treated it as an unary operator which divides by 100. So it can be stacked too: (8+8)%% = 0.0016
  • Since you can potentially add as many % operators as you want to a single operand, I had to put in some kind of limit. Initially I set it to max 3 % operators in a row, but later changed to 1 to make it faster.

With that in mind the results are...

I couldn't find any expressions with 6 8s or less. But with 7 8s they started coming in. Here's one:

$$ 8+\frac{8+8-8\%}{(88-8)\%\%}=8+\frac{15.92}{0.008}=8+1990=1998$$

The total results for 7x8 with no more than 1 % in a row are below. They are all in Polish Notation because that was easier for me to produce. Converting them to "normal" notation is straightforward, but tedious, so I'll leave that to someone else. :)

+ 8/+ 8- 8% 8%-% 88% 8
+ 8/-+ 8 8% 8%-% 88% 8
- 8/-% 8+ 8 8%-% 88% 8
+ 8/- 8-% 8 8%-% 88% 8
+ 8/+- 8% 8 8%-% 88% 8
- 8/--% 8 8 8%-% 88% 8
+/+ 8- 8% 8%-% 88% 8 8
+/-+ 8 8% 8%-% 88% 8 8
+/- 8-% 8 8%-% 88% 8 8
+/+- 8% 8 8%-% 88% 8 8
+/-% 8+ 8 8%-% 8% 88 8
+/--% 8 8 8%-% 8% 88 8
- 8/+ 8- 8% 8%-% 8% 88
- 8/-+ 8 8% 8%-% 8% 88
+ 8/-% 8+ 8 8%-% 8% 88
- 8/- 8-% 8 8%-% 8% 88
- 8/+- 8% 8 8%-% 8% 88
+ 8/--% 8 8 8%-% 8% 88

Note: I've checked all formulas with 6x8 and up to 2 % signs in row and didn't find anything. I also checked all 5x8 with up to 3 % signs in row. No results. However this doesn't prove that it's impossible to do with 6 or less 8. This only means that my code cannot find such combinations because it's beyond what it is capable of. The double data type does have its limits, and Legorin showed that you can have a legit answer with 1875 % signs in row (which is awesome, by the way). The code could be further improved to both increase accuracy and speed, but I've already wasted enough time on it as it is. If you want to give it a go, be my guest! :)

Vilx-
  • 1,383
  • 1
  • 7
  • 15
  • Impressive code. Did you try every possibility, so you could rule out the possibility of using less than 8 8s? – Eric Duminil Sep 12 '19 at 17:27
  • Wait, you didn't include any exponent, did you? – Eric Duminil Sep 12 '19 at 17:30
  • @EricDuminil - I added exponent and moved from float to double. That's a pretty serious performance hit, so I'm still waiting for results. There was nothing with 6x8, but 7x8 is taking a good while. – Vilx- Sep 12 '19 at 20:31
  • @EricDuminil - Aaaand done! We have solutions with 7x8! However they all seem to depend on "percentalizing" subresults. I guess that's acceptable? – Vilx- Sep 12 '19 at 20:36
  • Huh... I tried runnign 6x8 with double-percents and got some results too! The expressions look spaghettified. I'll have to verify those. At these magnitudes, it's likely that floating point errors are creeping in. – Vilx- Sep 12 '19 at 20:40
  • 5x8 with 3 percents didn't get results. And it took a good while. Seems like adding another % in row increases the processing time exponentially. I won't try 4 % in row, I don't think there will be any results. – Vilx- Sep 12 '19 at 20:46
  • What about exponentiation? – Eric Duminil Sep 12 '19 at 21:05
  • @EricDuminil - I added that. And the 6x8 solutions include that too. But for 7x8 it seems that the transition to double was more important. – Vilx- Sep 12 '19 at 21:09
  • @EricDuminil - Ahh it was a bug. Fixed it, trying again. – Vilx- Sep 12 '19 at 22:00
  • 1
    @EricDuminil - OK, final results. 6x8 with 2x% didn't yield any results. – Vilx- Sep 12 '19 at 22:15
15

I have a solution with 12 8s

$((8+8) \times (8+8) \times 8) - (8\times8) + (8+8) - \frac{8+8}{8}$

Updated, another with 9 8s

$\frac{8888-8}{8} + 888$

Herb
  • 3,333
  • 2
  • 17
  • 31
15

I found another solution with 8.

$$(\frac{8}{8\%\%...\%\%}^{8\%\%} - \frac{8}{8})\frac{8+8}{8}=1998$$

the %%...%% is 1875 % symbols

$$\%=\frac{1}{100}$$ $$8\%\%=\frac{1}{1250}$$ $$\frac{8}{8\%\%...\%\%}=1000^{1250}$$

therefore

$$\frac{8}{8\%\%...\%\%}^{8\%\%} = 1000$$ $$1000 - \frac{8}{8} = 999$$ $$999(\frac{8+8}{8})=1998$$

Legorhin
  • 379
  • 1
  • 5
  • By far the most amazing answer (+1) – Adam Sep 12 '19 at 18:30
  • you can also do 8/((88-8)%%) to get 1000 but thats less fun and 4 8s – Legorhin Sep 12 '19 at 23:16
  • Based on the rules established by this meta post and the consensus around it, an answer must have justification for why the solution is optimal. Without that, this is a comment, not an answer. – Deusovi Sep 13 '19 at 05:28
  • Can we get the number of percent symbols up to 1998, while still producing the number 1998? – Bjartur Thorlacius Sep 13 '19 at 14:04
  • Actually, yes, you can. Both 8/8 and (8+8)/8 allow you to add as many % symbols as you like, as long as you do it symmetrically to both sides of the fraction. So 8/8=8%/8%=8%%/8%%=... and (8+8)/8=(8%+8%)/8%=.... Using this you can get up to 1998 % in total. – Vilx- Sep 13 '19 at 20:53
13

Here is a hilarious solution for 9

$(\frac{8+8}{8})^{\frac{88}{8}}-\frac{8}{(8+8)\%}=1998$

For research purposes I'll also include my kinda illegal solution for 7

$\frac{8+8}{8}(\frac{8}{.8\%}-\frac{8}{8})=1998$

Adam
  • 2,907
  • 1
  • 13
  • 36
9

A solution with nine $8$s:

$$\frac{88+(8\times8)+8}{8\%} - \frac{8+8}{8}$$

i.e.

$1100 + 800 + 100 - 2$, taking advantage of the fact that $\%$ is an allowed operation.

A very simple solution with ten $8$s (which I'm surprised nobody else has done):

$$\frac{8888}{8} + 888 - \frac{8}{8}$$

Rand al'Thor
  • 116,845
  • 28
  • 322
  • 627
  • I saw this puzzle on a site and thought to ask this SE about it. The given solution on the site had ten 8s, so this is technically an improvement. Nice work, Rand! – Andrew Sep 11 '19 at 17:10
  • Wow! I was expecting this to be still not optimal, since in a previous comment you mentioned eight 8s. – Rand al'Thor Sep 11 '19 at 17:11
  • Well... I misremembered.

    It was not a real site. It was a DM with a friend in school. I'll make sure to mention this in an edit.

    – Andrew Sep 11 '19 at 17:15
  • I didn't see your solution with 10, but I added a similar one with 9 8s. – Herb Sep 11 '19 at 17:23
  • 2
    the reason no one had done the "very simple solution" was that things like 88, 888, etc were not declared as permissible until relatively shortly before your answer. – Ben Barden Sep 11 '19 at 18:33
  • Based on the rules established by this meta post and the consensus around it, an answer must have justification for why the solution is optimal. Without that, this is a comment, not an answer. – Deusovi Sep 13 '19 at 05:28
  • Because you can factor ${1 \over 8}$ to get ${8888 - 8 \over 8} + 888$. – Florian F Dec 14 '20 at 19:40
7

Here's a solution with $9$ eights, without using the % operator:

$$ \frac{888}{8} ( 8+8 + \frac{8+8}{8}) = 111*18=1998$$

Jaap Scherphuis
  • 53,019
  • 7
  • 120
  • 208
  • Based on the rules established by this meta post and the consensus around it, an answer must have justification for why the solution is optimal. Without that, this is a comment, not an answer. – Deusovi Sep 13 '19 at 05:28
6

Thanks to a comment from Ben Barden, here is another way of achieving 11 8s

$8+8+\left(\left(\frac{8+8}{8}\right)^8 - 8\right)\times 8-\frac{8+8}{8}$

hexomino
  • 135,910
  • 10
  • 384
  • 563
4

My first try, with ten:

$\frac{8888}{8} + 888 - \frac{8}{8}$

Only 4 operators

3

Stealing gloriously from the work of others, I have it down to 11:

$(((8+8) \times (8+8) - 8) \times 8) + (8+8) - \frac{8+8}{8}$

Rand al'Thor
  • 116,845
  • 28
  • 322
  • 627
Ben Barden
  • 2,071
  • 9
  • 12
2

If you allow concatenation of intermediate results (not just the original $8$s), here's a solution with $7$ eights:

$$\frac{888}{8}*\left(\frac88 8 \right)$$ The concatenation $\left(\frac88 8 \right)$ works out to $18$.

paw88789
  • 301
  • 1
  • 3
  • If concatenation is not specified, would the assumed result of the equation in your parenthesis not be 8 (i.e. 8/8*8 = 8)? I think concatenation is usually denoted with || i.e. 8/8||8 - Although I stand to be corrected! – Frits Sep 12 '19 at 09:53
  • You literally stole this answer from trolley813's comment – Adam Sep 12 '19 at 10:18
  • @Adam I didn't see the comment. So you may consider it "stealing", but I came up with it independently. Nevertheless, thanks for pointing it out. I will delete my answer. – paw88789 Sep 12 '19 at 11:04
  • If you allow that you can do much better: $\frac{8+8-8%}{8%}||8$ – Paul Panzer Dec 12 '20 at 02:29
1

Straightforward solution with 9 8s:

$(\frac{88 - 8}{8} + 8) \times (\frac{888}{8})$

Adam
  • 2,907
  • 1
  • 13
  • 36
Helena
  • 1,186
  • 1
  • 8
  • 9
  • Based on the rules established by this meta post and the consensus around it, an answer must have justification for why the solution is optimal. Without that, this is a comment, not an answer. – Deusovi Sep 13 '19 at 05:28