Simon has come up with an equation to solve the Too many Twos, the puzzle mode of the Add ‘Em Up game:
x is the number of twos I used to clear out just a single two at a time
y is the number of twos I used to clear out six twos at once.
We have two pieces of information. At the beginning, the twos are arranged in a pattern with 40 twos in it. And the number of twos I can use to clear out the whole grid is 25.
x + 6y = 40
x + y = 25
We thought we solved it, but no! The reason why is because of the way the twos are arranged there were spots where there were exactly 6 twos neighbouring an empty cell. And there was only one spot where there wee more than 6. Our equation says that there must be 3 of those. the way I solved this problem was by considering a third variable, z = the number of twos that I place without clearing any twos in the grid. So now our two equations look like this:
x + 6y – z = 40
x + y + z = 25
With a little bit of cleverness though, we know that these are all integers. You don’t have 2.7 twos! That doesn’t exist! Which means that we can use some number theory to narrow it doen. After solving these equations we get: x = 25 – y – z and y = 3 + 2z/5
We’ve got a fraction. We need to carefully choose the z for this to result in an integer! This is only true if z is divisible by 5.
I don’t want to check infinitely many solutions. Luckily, we know one more quite obvious thing: all of our variables must be positive. So if z gets too large, x will become negative. How large? Let’s just be lazy and use trial and error. Let’s draw a table. In our table we now only have four solutions that we need to check. The first one, with 0 z‘s, clearly doesn’t work.