Solving the Magic Hexagon Puzzle

First, start with the hint to solve the Magic Hexagon Puzzle (opens in new tab). Without the hint, there are one hundred quadrillion ways to place 19 tiles in the array. The hint gives you the locations of six tiles. Now, with the hint, there are still over six billion ways to place 13 tiles, a large reduction but still too many for our slow hands and short lives!

So next, you are going to have to use some logic in solving the puzzle. My strategy was to solve the 3-tile rows on each of the six sides of the hexagon. Next, I placed tiles in the two 4-tile horizontal rows, and lastly in the middle 5-tile horizontal row. On my first try, I got all rows solved, except for three contiguous diagonal rows. The middle one of these rows had a sum that was too high by 4, with each of the two neighboring rows too low by 2. I suspect a couple swaps between these three rows would have obtained a complete solution were I to continue. So it will be possible for you to solve the puzzle.

There are references to this puzzle’s history (and solution) on the web. From Wikipedia’s article Magic Hexagon, “The order-3 magic hexagon with numbers 1 through 19 and magic sum 38 has been published many times as a ‘new’ discovery. An early reference, and possibly the first discoverer, is Ernst von Haselberg (1887).” Wikipedia says that the order-3 magic hexagon has a unique tile-arrangement solution, and is the only ‘normal’ hexagon, which is one with sequential integer tile numbers starting at one. The article then describes several ‘abnormal’ magic hexagons with different lists of integer tile numbers.

In a side project, I sought a direct linear algebra solution to tile placement using the hint and Matlab. This turned out not to be possible because the coefficient matrix was very sparse and singular, and a solution couldn’t be obtained or approximated by any of Matlab’s methods. For fun, I also used Matlab to do a brute force random search for a solution using the hint. Note that a direct search using permutations of tile numbers wasn’t possible because the over six billion permutations were too many to be generated. I obtained the unique solution in several runs after as many as five billion tries and as few as several hundred million.

After finishing my 19-tile magic hexagon web app, I thought that a smaller hexagon array with two tiles on a side and seven total tiles would be easier to solve. Nope! After using Claude Code to write a script for computation in Matlab, then reading more on the web, I discovered that there is no list of integers, not sequential, not starting at one, nor otherwise, for which one can obtain a common row sum for this smaller hexagon!

Please send us a message letting us know what you think at support@reactorlab.net