## 4 + 4 + 4 + 4 =16

Posted by ragknot on June 11, 2013 – 8:51 pm

This is like another old ToM. LOL and pretty easy.

If each of the “+”’s could be either “+” or “-” or “*” or “/” then

how many different answers could there be?

And what would be the largest and the smallest answers?

June 12th, 2013 at 12:27 am

In order of magnitude (I counted 24):

-60

-16

-15

-8

-7

-3.75

-1

0

0.0625

1

2

3.75

4.25

7

8

9

15

16

17

24

32

60

68

256

June 12th, 2013 at 4:34 am

I was going to say 4^3 = 64, but realised that was naive. So 64 is only the upper bound. Obviously there are less possibilities as without any effort I can see several ways to get 0. e.g. 4/4 – 4/4 and 4*4 – 4*4 etc.

June 12th, 2013 at 5:51 am

Jan!

Correct! 24 different answers

Also there are 64 different equations, and nine of them will give zero.

4 + 4 – 4 – 4= 0

4 / 4 * 4 – 4= 0

4 / 4 – 4 / 4= 0

4 * 4 / 4 – 4= 0

4 * 4 – 4 * 4= 0

4 – 4 + 4 – 4= 0

4 – 4 / 4 * 4= 0

4 – 4 * 4 / 4= 0

4 – 4 – 4 + 4= 0

But then suppose that “(” and “)” could be used.

June 12th, 2013 at 5:58 am

Upper bound?

Well, 4 * 4 * 4 * 4= 256, like Jan showed.

The 64 different ways gave me…

June 12th, 2013 at 6:04 am

What? This screen does something weird. The first I enter was 3 minus’s and it looks like this. I will do it again.

Three minus’s with spaces is – - -, but without spaces it looks like “—” !

June 12th, 2013 at 6:11 am

Hi ragknot. I’ve fixed it. You need to use the <pre> tag at the beginning and end it with </pre>

I’m afraid this silly nonsense is down to the daft spec of html.

June 12th, 2013 at 6:17 am

Thanks Chris! I just saw it was repaired.

June 12th, 2013 at 7:38 am

Me too, 24 it is.

June 12th, 2013 at 9:44 am

June 12th, 2013 at 11:12 am

By upper bound I mean the maximum number of possible different results.

—–

Now what if add “^” (exponentiation) to the list of operators!!!!!

—–

Minor VBA tip. You can evaluate a mathematical expression thusly:

result = Evaluate(“4*4+4-4″)

result will contain 16 as a numeric type.

June 12th, 2013 at 2:59 pm

If I add “^” I get 51 unique answers. Pretty obvious what the biggest and smallest answer is.

June 12th, 2013 at 4:07 pm

Wow DP, you did it just like I did.

June 12th, 2013 at 8:28 pm

I’m guessing that we’re all using computers for this one. I did. My code is very quick and dirty. This one is for the 5 operator version. I’ve gone a bit OTT on one aspect – I needn’t have bothered with the maffs type or saving the evaluation strings.

I get 51 unique values too.

June 13th, 2013 at 6:48 am

I actually just did it in excel the brute-force way following a pattern (+,-,*,/) …

+++

++-

++*

++/

+-+

+–

+-*

+-/

……

then sorted by value.