Notes · sphere packing

435 in 32,164: which segment sets tile a tetrahedron

Most ways of picking pieces that add up to 35 balls can't actually be assembled. Here's how a small solver found the ones that can.

By Jakub Mráček · 8 min read

Spheromino is a puzzle about how spheres pack. The target is a tetrahedron of edge 5 — a little pyramid of 35 close-packed balls — and you build it from coloured segments, rigid clusters of 1 to 5 balls joined at right angles. There are 21 segments in the full alphabet, A through U.

A natural question kept nagging me: which subsets of those 21 segments can actually be assembled into the tetrahedron? It sounds like it should be easy. It isn't — and the reason is a nice little tour through close packing, exact cover, and the gap between arithmetic and geometry.

The board is made of triangular numbers

Slice the tetrahedron into horizontal layers and each is a triangle: 1, 3, 6, 10, 15 balls. They sum to 35 — the 5th tetrahedral number, itself a running total of triangular numbers.

1
3
6
10
15
Five triangular layers — 1 + 3 + 6 + 10 + 15 = 35, the 5th tetrahedral number. Each layer is a triangular number.

Step one: what even adds up?

A set can only tile the tetrahedron if its pieces contain exactly 35 balls. So the first filter is pure arithmetic: enumerate every subset of the 21 segments whose sizes sum to 35. That already prunes hard — but it still leaves roughly 32,164 size-valid candidate sets.

Here's the trap: adding up to 35 says nothing about whether the pieces fit. A bag of pieces can have the right total and still leave a hole no remaining piece can fill. Arithmetic is necessary, not sufficient. To know for sure, you have to try to build it.

Step two: the geometry is FCC, not a cube

The first thing I got wrong was the lattice. It's tempting to treat the ball positions like a cubic grid where neighbours differ by 1 in a single coordinate. But close-packed spheres sit on a face-centred-cubic lattice, and in the puzzle's skew (60°) coordinates two balls touch exactly when a quadratic form equals one:

Q(Δ) = Δx² + Δy² + Δz² + Δx·Δy + Δx·Δz + Δy·Δz = 1

That gives each interior ball 12 neighbours, not 6. It also means a "straight" two-ball domino can occupy positions that differ by 1 in two coordinates at once. Get this wrong and every placement check is subtly broken; get it right and the pieces behave like real spheres.

Step three: search it as an exact cover

"Fill 35 cells, each exactly once, using these pieces" is a textbook exact-cover problem — the same shape as tiling a board with polyominoes. For each segment I precompute every placement (every position × orientation that lands on valid, empty cells), encode each as a 35-bit mask, and run a bitmasked Algorithm X-style backtracking search: pick the most-constrained empty cell, try each piece that covers it, recurse.

Two details matter. First, the pieces only rotate — never reflect: I checked that all 20 used segments are achiral, so a mirror image is never a genuinely new piece. Second, to count distinct solutions rather than the same one seen from 12 angles, each solved object is canonicalised over the tetrahedron's rotation group (A₄, 12 rotations). That collapsed the known solved objects from 31 recorded rows down to 24 truly distinct ones.

The result: at least 435

Running the search over all ~32,164 candidates, the solver confirmed every one of the 17 sets already known to work (a nice sanity check) and found 418 new ones435 tileable sets in total, about 1.4% of the arithmetic candidates. By piece count they land like this:

  • 8 segments → 12 sets
  • 9 segments → 364 sets
  • 10 segments → 59 sets

I say at least 435 on purpose. The search runs each candidate under a node budget; a few thousand hard cases hit the budget without a verdict, so they're neither confirmed nor ruled out. 435 is a firm lower bound, and the count only goes up as the budget does.

From sets to puzzles — and a uniqueness surprise

A tileable set gives you a solved object. To make a puzzle, you hide some of its segments and ask the player to put them back — more hidden pieces, harder puzzle. But a puzzle is only fair if it has a single solution, and here I got a surprise: of the 35 hand-made puzzles I started with, only 12 had a unique solution. The other 23 had two or more ways to replace the hidden pieces.

So generation has to actively enforce uniqueness — hide a subset, re-solve, keep it only if the answer is forced. With that filter, a couple dozen objects expand into thousands of clean, single-solution puzzles, graded from Beginner to Genius by how much is hidden.

Try it

All of this runs under the puzzles you can play and print for free. If you like this kind of thing, the science page has more on the packing, and you can build a physical set from beads, a 3D printer, or a bag of balls.

Spheromino is an open, education-focused puzzle project. spheromino.com