4
$\begingroup$

Fill the blanks by using each of the four arithmetical operations only once ($+$,$-$,$\div$,$\times$) to make the result biggest:

enter image description here

For example:

$121-2+12\times12\div1=263$ but this is not the biggest result you can get.

$\endgroup$
9
  • $\begingroup$ Can we group terms? $\endgroup$
    – Morgan G
    Commented Aug 22, 2017 at 18:50
  • $\begingroup$ Can we skip operations (not using all the four operations) $\endgroup$
    – yass
    Commented Aug 22, 2017 at 18:52
  • 1
    $\begingroup$ Is standard order of operations used, or is it left-to-right? $\endgroup$
    – Deusovi
    Commented Aug 22, 2017 at 18:52
  • $\begingroup$ @yass you are supposed to use all four operations once. $\endgroup$
    – Oray
    Commented Aug 22, 2017 at 18:52
  • $\begingroup$ @MorganG you can fill only one operation into the squares. $\endgroup$
    – Oray
    Commented Aug 22, 2017 at 18:54

4 Answers 4

7
$\begingroup$

my best answer(No longer my best, but I left it as it was my best at one time..)

1+2121x21-2/1=44540

I got to this using the following logic

multiplication is the only function that will grow the answer in a big way, so we need to optimize the multiplication- beginning the largest number with a 2 is in our best interest, so we needed to chop the 1 off the front. can not use a minus here, as it would make our result negative. which leaves only addition. This leaves only - and / remaining. To divide by 2 -1 would divide the answer by 2 then minus 1, so we are left with my answer.

a new answer!

1+212/1x212-1 = 44944

I got this by

using the same logic but playing with the placement of the division. this shortened up my longest integer by 1, but added 100 to the second largest (in this case even) It works out to be a larger number, albeit not by much.

$\endgroup$
3
  • $\begingroup$ FYI: this is not the biggest result you can have, nor is yours @humn. $\endgroup$
    – Oray
    Commented Aug 22, 2017 at 19:16
  • $\begingroup$ Thanks for the heads up that it was not the best possible answer. I revisited my method, and came up with a new and better answer:) $\endgroup$
    – Jason V
    Commented Aug 22, 2017 at 19:26
  • 1
    $\begingroup$ @JasonV this is not just better, but the best answer :) $\endgroup$
    – Oray
    Commented Aug 22, 2017 at 19:27
4
$\begingroup$

Top 10 contenders:

enter image description here

My approach using Ruby:

num = [1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1]
opr = [3,4,5,6]

#3->+
#4->-
#5->/
#6->*

plc = [1,3,5,7,9,11,13,15]

$i=0

results = []
express = []

while $i < 100000 do
    opr = opr.shuffle

    tempRand=plc.shuffle.take(4)

    num[tempRand[0].to_i] = opr[0]
    num[tempRand[1].to_i] = opr[1]
    num[tempRand[2].to_i] = opr[2]
    num[tempRand[3].to_i] = opr[3]

    tempString = ''

    num.each do |e|

        if e.to_i == 0
            tempString << ''
        elsif e.to_i == 3
            tempString << '+'
        elsif e.to_i == 4
            tempString << '-'
        elsif e.to_i == 5
            tempString << '/'
        elsif e.to_i == 6
            tempString << '*'
        else
            tempString << e.to_s
        end
    end

    results << eval(tempString)
    express << tempString

    num[tempRand[0].to_i] = 0
    num[tempRand[1].to_i] = 0
    num[tempRand[2].to_i] = 0
    num[tempRand[3].to_i] = 0

    $i += 1
end

print_me = Hash[results.zip(express)]

puts print_me.sort.reverse

(try it here)

Basically just randomly swap the 0s (the blank spaces) with operators and then evaluate the result without 0s. It's not the best way to do it, but over a 100,000 iterations the max is 44,944.

$\endgroup$
2
  • $\begingroup$ It's interesting that the lowest is not symmetric: -44942 compared to 44944 $\endgroup$
    – user39732
    Commented Aug 23, 2017 at 22:05
  • $\begingroup$ FYI, this is really a sloppy brute approach, and does not suffice as proof, but it's pretty d&%n good. $\endgroup$
    – user39732
    Commented Aug 23, 2017 at 22:21
0
$\begingroup$

Best I could come up with:

 121 x 212 - 1 + 2 ÷ 1 = 25,653

$\endgroup$
0
$\begingroup$

1 + 21212 / 1 * 2 - 1 = 42425

$\endgroup$
2
  • $\begingroup$ Can you prove why this is the biggest possible? $\endgroup$ Commented Aug 23, 2017 at 11:15
  • $\begingroup$ Since the answer is already marked. I think this one would be wrong :( $\endgroup$
    – Kevin
    Commented Aug 23, 2017 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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