Mental Floss

Time for Some Mental Hygiene: It's the mental_floss Weekly Puzzle

By Editorial Staff

Cat videos are cool and all, but the next time you’re in need of a mid-day pick-me-up, consider something slightly more stimulating: our weekly brain teaser, created by the late, great mathematician and puzzle master Martin Gardner. This week, it’s up to you to predict the movement of a termite on a cube.

Once you've worked out a solution, scroll down to see if you're right.

From My Best Mathematical and Logic Puzzles, Martin Gardner, 1994, Dover Publications, Inc. Buy at Amazon.


Imagine a large cube formed by gluing together 27 smaller wooden cubes of uniform size as shown. A termite starts at the center of the face of any one of the outside cubes and bores a path that takes him once through every cube. His movement is always parallel to a side of the large cube, never diagonal.

Is it possible for the termite to bore through each of the 26 outside cubes once and only once, then finish his trip by entering the central cube for the first time? If possible, show how it can be done; if impossible, prove it.

It is assumed that the termite, once it has bored into a small cube, follows a path entirely within the large cube. Otherwise, it could crawl out on the surface of the large cube and move along the surface to a new spot of entry. If this were permitted, there would, of course, be no problem.


It is not possible for the termite to pass once through each of the 26 outside cubes and end its journey in the center one. This is easily demonstrated by imagining that the cubes alternate in color like the cells of a three-dimensional checkerboard, or the sodium and chlorine atoms in the cubical crystal lattice of ordinary salt. The large cube will then consist of 13 cubes of one color and 14 of the other. The termite's path is always through cubes that alternate in color along the way; therefore if the path is to include all 27 cubes, it must begin and end with a cube belonging to the set of 14. The central cube, however, belongs to the 13 set; hence the desired path is impossible.

The problem can be generalized as follows: A cube of even order (an even number of cells on the side) has the same number of cells of one color as it has cells of the other color. There is no central cube, but complete paths may start on any cell and end on any cell of opposite color. A cube of odd order has one more cell of one color than the other, so a complete path must begin and end on the color that is used for the larger set. In odd-order cubes of orders 3, 7, 11, 15, 19 ... the central cell belongs to the smaller set, so it cannot be the end of any complete path. In odd-order cubes of 1, 5, 9, 13, 17 ... the central cell belongs to the larger set, so it can be the end of any path that starts on a cell of the same color. No closed path, going through every unit cube, is possible on any odd-order cube because of the extra cube of one color.

Many two-dimensional puzzles can be solved quickly by similar "parity checks." For example, it is not possible for a rook to start at one corner of a chessboard and follow a path that carries it once through every square and ends on the square at the diagonally opposite corner.