Make a Number

Fairly simple game - one that I like to play with my kids.

You are given 5 numbers between 1 and 9. Using just +, -, x, / and () use the first 4 to make the 5th. You have to use all 4, and can only use them once.

Example:
[ 3 9 8 3 | 8 ]
( 9 / ( 3 x 3 ) ) x 8 = 8

Probably best to spoiler your answers. Apparently this is how to do that:

I generated these randomly. Some will probably be trivially easy. Hopefully some will provide a bit of a challenge. Some may even be impossible.

1: [ 2 3 5 6 | 8 ]
2: [ 3 3 2 6 | 8 ]
3: [ 7 3 2 7 | 9 ]
4: [ 5 5 4 4 | 4 ]
5: [ 4 8 4 8 | 2 ]
6: [ 8 8 9 4 | 1 ]
7: [ 6 9 3 5 | 6 ]
8: [ 4 8 8 2 | 5 ]
9: [ 3 8 6 1 | 2 ]
10: [ 3 7 9 7 | 8 ]

Interesting. I feel like I want to look for an algorithm or patterns.

There are a few go-to “tricks” that I usually start with. Often making a 0 or a 1 is very helpful.

I’ve found that there aren’t all that many that are impossible. Obviously something like [ 1 1 1 1 | 6 ] isn’t going to work, but most of them do.

I usually play this with my kids using playing cards (A through 9).

Now I want to create a program to play this here.

I’ll start posting my solutions:

1: [ 2 3 5 6 | 8 ]

Solution #1

( ( 6 / 3 ) x 5 ) - 2 = 8

2: [ 3 3 2 6 | 8 ]

Solution #2

( ( 3 / 3 ) x 2 ) + 6 = 8

3: [ 7 3 2 7 | 9 ]

Solution #3

( ( 7 / 7 ) + 2 ) x 3 = 9

Alternatively:

7 + 7 - 3 - 2 = 9

4: [ 5 5 4 4 | 4 ]

Solution #4

( ( 5 - 5 ) x 4 ) + 4 = 4

5: [ 4 8 4 8 | 2 ]

Solution #5

(4 / 4 ) + ( 8 / 8 ) = 2

I’ll do some more a bit later.

6: [ 8 8 9 4 | 1 ]

Solution #6

( 8 / 4 ) + 8 - 9 = 1

7: [ 6 9 3 5 | 6 ]

Solution #7

( ( 9 - 6 ) / 3 ) + 5 = 6

8: [ 4 8 8 2 | 5 ]

"Solution #8

4 + 2 - ( 8 / 8 ) = 5

9: [ 3 8 6 1 | 2 ]

Solution #9

6 + 3 + 1 - 8 = 2

10: [ 3 7 9 7 | 8 ]

Solution #10

( 7 - 3 ) x ( 9 - 7 ) = 8

And the winner is…

let the suspense build....
hey, you can nest spoilers!
Doesn't look quite as cool as the AO though

soyleche!

I know, everyone is really surprised.

A more complicated one. I didn’t figure out the solution - I had to be shown:

[ 1 1 5 8 | 10 ]

[ 1 1 5 8 | 10 ]

solution

8 / ( 1 - ( 1 / 5 ) )

Yay!

Good job.