# Math Snake Puzzle

A colleague recently showed me the following puzzle game and I'm interested in how this can be solved. I thought it would be a good talking point for you guys as well :)

A detailed description of the puzzle is here. A sequence of 7 cubes may be rotated about the axis. The puzzle is to rotate them until all 4 equations are correct, such as $2 + 2 / 4 = 1$. Operators are evaluated left to right. The faces of the cube presented in the video (not agreeing with the image) are:

The following pictures show the sides...

Question

Other than trial and error, is there an easy way to solve this?

• How do you prioritize operations? Left to right, or multiplication first? There is an easy answer, $1+1+1+1=4$, but to ask "how many solutions are there" is a more interesting question. – DanielV Jun 21 '16 at 16:31
• Each numeric cube has 4 options, 1 ,2, 3, 4. So if you use the number 1 on one side you cannot use it on another. The same applies with the operations. – fml Jun 21 '16 at 16:33
• Very similar to this, but harder... interesting! – ArtW Jun 21 '16 at 16:36
• @DanielV: There aren't enough dice for $1+1+1+1=4$; but $1+1+1=3$ would work. – joriki Jun 21 '16 at 16:51
• There are 6 possible way to arrange the numbers, op cubes (1,2,3,4 and 1,2,4,3 and 1,3,2,4 and 1,3,4,2 and 1,4,2,3 and 1,4,3,2) but only 3 and 2 of them are used. We need to see what the other two sides of the snake are in order to solve this. – fleablood Jun 21 '16 at 17:02

The puzzle in the video only has 1 solution.

$$\begin{array} {|c|c|c|c|c|c|} \hline 4 & - & 3 & \times & 3 & = & 3 \\ 2 & + & 2 & \div & 4 & = & 1 \\ 1 & \times & 4 & - & 2 & = & 2 \\ 3 & \div & 1 & + & 1 & = & 4 \\ \hline \end{array}$$

I doubt there is any significantly faster way to solve it than with a computer. It's only $4^6 \div 4 = 1024$ cases to check. I doubt there is a faster way than with a computer, since in general there can a large number of solutions. This is a combinatorial logic problem, so it is NP, and I don't see any obvious way to put it into P.

• Usually $4-3\times 3=-5$ and $2+2/4=2.5$ – miracle173 Jun 21 '16 at 20:36
• you changed the second operator sequence from $\times, -, +, \div$ to $\times, \div, -, +$. – miracle173 Jun 21 '16 at 21:09
• @miracle173 I did not, the questioner changed it incorrectly. The one I posted is correct according to the video linked. – DanielV Jun 21 '16 at 21:45
• on the website I found "The equation is read from left to right, irregardless of operation priority.", so you are right – miracle173 Jun 21 '16 at 21:50

I just realised that I didn't get it, I just thought all the cubes had to show different numbers/symbols.

A solution that uses each number exactly once, and two different operations $$\frac{4}{2}+1=3$$

I found that thinking about what divisions were possible. Obviously we can divide by one, but then we're just left with one operation ($+$, $-$ or $*$) on $\{2, 3, 4\}$, so 9 possibilities, it's not hard to check all of them and conclude that there are no solutions.

If we want the division to give an integer result the only other option is $\frac{4}{2}$, and that gives the solution I've already named.

If we just ignore a remainder from a a division, we get more solutions, like: $$\frac{4}{3}+1=2$$

• Apparently all four sides must match simultaneously. And there's no restriction that each cube be used at most once in an equation. – fleablood Jun 21 '16 at 17:22
• Yes, I've realised that. Didn't get when I saw the question while on the train, and then thought about this during my walk from the station, and when I got home I didn't bother reading the new comments before typing up my answer. – Henrik Jun 21 '16 at 17:28
• Neither did I. <><><><> – fleablood Jun 21 '16 at 17:44