# Find the Biggest Value

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

For example:

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

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

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.

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.

• FYI: this is not the biggest result you can have, nor is yours @humn.
– Oray
Aug 22 '17 at 19:16
• 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:) Aug 22 '17 at 19:26
• @JasonV this is not just better, but the best answer :)
– Oray
Aug 22 '17 at 19:27

Top 10 contenders:

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.

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

Best I could come up with:

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

1 + 21212 / 1 * 2 - 1 = 42425

• Can you prove why this is the biggest possible? Aug 23 '17 at 11:15
• Since the answer is already marked. I think this one would be wrong :( Aug 23 '17 at 11:16