In the fourth century, the Greek mathematician Pappus of Alexandria praised bees for their “geometrical forethought.” The hexagonal structure of their honeycomb seemed like the optimal way to partition two-dimensional space into cells of equal area and minimal perimeter — allowing the insects to cut down on how much wax they needed to produce, and to spend less time and energy building their hive. Or so Pappus and others hypothesized. For millennia, nobody could prove that hexagons were optimal — until finally, in 1999, the mathematician Thomas Hales showed that no other shape could do better. Today, mathematicians still don’t know which shapes can tile three or more dimensions with the smallest possible surface area. This “foam” problem has turned out to have wide-ranging applications — for physicists studying the behavior of soap bubbles (or foams) and chemists analyzing the structure of crystals, for mathematicians exploring sphere-packing arrangements and statisticians developing effective data-processing techniques.