RC RANDOM CHAOS

AI-Built Solver Cracks Magic Hexagons Far Past the Previous Order-9 Record

· via Hacker News

Original source

There Are Magic Hexagons of Every Order

Hacker News →

A magic hexagon fills a hexagonal grid so that every straight line of cells, in all three directions, adds to the same total. Only one non-trivial ‘normal’ version exists — the famous 19-cell, order-3 arrangement — because for any larger order the sum of the required consecutive integers isn’t divisible by the number of lines. Relaxing the rule so the numbers stay consecutive but need not start at 1 yields so-called abnormal magic hexagons, but these have no known construction formula and must be hunted through an enormous search space. As of mid-2026 the largest known was an order-9 solution found in 2024.

The author’s insight was to shrink the search space rather than speed up the search. Restricting values to a symmetric range around zero, placing 0 at the center, and forcing antipodal cells to hold opposite values makes most line-sum constraints cancel automatically. A second reframing represents any zero-sum hexagon as a ‘potential field’ — a linear combination of local alternating six-cell rings — so that every candidate already satisfies the line sums by construction, leaving only the harder requirement that the visible values be distinct and consecutive.

The implementation was largely written by an LLM (GPT-5.6 Sol), which connected the problem to Heffter arrays and replaced generic constraint solvers like Z3 and OR-Tools with a custom simulated-annealing routine, later tuned with Numba and perf profiling. Running a few days across roughly 24 CPU cores, it produced magic hexagons of every order up to 21 — a dramatic jump past the prior record. The potential fields of these solutions look like smooth terrain maps, hinting at a deeper hidden structure and, per the article’s framing, a path toward constructing hexagons of arbitrary order.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.