# The mathy square strikes back!

This is a follow-up question to Does this mathy square have any solutions? (And how many?).

Consider a 7x7 grid of math operators o and numbers A, B, ..., P:

A o B o C o D
o o o   o o o
E o F o G o H
o   o o o   o
I o J o K o L
o o o   o o o
M o N o O o P


This grid encodes 10 math equations. There are 4 horizontal equations, 4 vertical, and 2 diagonal. Specifically:

A o B o C o D
E o F o G o H
I o J o K o L
M o N o O o P
A o E o I o M
B o F o J o N
C o G o K o O
D o H o L o P
A o F o K o P
D o G o J o M


Note that the central operator o at position (4,4) is shared by both of the diagonal equations.

The question is: Can the letters A through P be replaced with all distinct numbers 1 through 16 in any order, and the placeholder operators o by + or * or = such that all 10 grid equations are satisfied? Operator precedence is the usual, no grouping is allowed.

Are there lots of solutions or none at all?

• ...and only one = per resulting equation I presume? – Jonathan Allan Aug 29 '16 at 20:12
• I believe this condition is implied. – Matsmath Aug 29 '16 at 20:12
• And even if it weren't: the only ways to divide the four numbers with two equals signs are 1/1/2, 1/2/1, and 2/1/1; either way the equation asserts that two of the numbers must be equal, which cannot be true since they are all distinct. (There is similar reasoning preventing three equals signs.) – 2012rcampion Aug 30 '16 at 7:55

There are:

Many solutions

For example:

and the various rotations / reflections of the above. Also, swapping rows 1 and 2 and swapping rows 3 and 4 in the above solution produces a new solution (plus the associated rotations/reflections).

• Yes, this seems to be correct. It is also very elegant since uses operator + only, and the equal signs are aligned in a symmetrical way. This particular solution you found could be a great puzzle for small children. – Matsmath Aug 30 '16 at 14:30

Here is another solution with a bit more variation in the equations.

 1 +  2 *  4 =  9
* *  *    + +  +
13 + 11 = 16 +  8
=    = =  =    =
3 + 15 =  6 + 12
+ +  +    + +  +
10 *  7 = 14 *  5

This is the first of many that my program spat out, but it does not check that the centre symbol is the same for the two diagonal equations, so it is hard to tell how many solutions there are. Probably quite a lot.

• I believe that an answer with all * operators (if exist) could be another useful contribution. By the way, I am missing some operators on one of the main diagonals. – Matsmath Aug 30 '16 at 14:48
• I added the missing operators. – Jaap Scherphuis Aug 30 '16 at 14:50
• Also, there is no solution without additions, only multiplications. – Jaap Scherphuis Aug 30 '16 at 14:52
• Nice. My program tells me that the number of solutions is 124 modulo 191 (I don't want to give away the exact answer). – Matsmath Aug 30 '16 at 14:56