Tesseracts in a Box GitHub
4D packing · new candidates · Oct 2026

29 tesseracts in a box of side 2.9428

A 4D search fit 26 to 30 unit hypercubes in smaller boxes than any construction we could find. You can rerun it right here.

new · candidate2.9428this work, n = 26 to 29
conjecture2 + 2√2 / 3exact form? agrees to 4 × 10⁻¹⁰
was2.956previous construction, n = 26
was2.98995previous construction, n = 27, 28
was3previous construction, n = 29, 30

Interactive

The packing lab

Drag to turn it in 4D. Press Run search to watch a packing squeeze itself together.

box side2.942809
to beat2.989949
found packing
corner, axis-aligned tilted overlapping

Small squares: the packing's shadows on the six coordinate planes, box drawn as a square.

Loading the found packing.

cubes
27
worst overlap
0
L-BFGS steps
0
best this session
none yet
Search settings
2.90
0.030
3,000
45°

Run builds a fresh packing from the seed; Basin hop tries to shrink whatever is on screen.

How a run works

The 25-cube construction is stretched to side s₀ and n − 25 cubes are dropped in at random; then the box shrinks under no-overlap constraints. The same seed and settings give the same run, though browsers can round differently late in a run. With the defaults, seed 23 settles near 2.9435 for n = 26.

The short version

Squeeze, tilt, check

01The puzzle

How small can a 4-cube be if it must hold n unit 4-cubes, turned any way you like? Side 2 holds 16 and side 3 holds 81; in between, the cubes have to tilt.

Turn the middle square 45° and five fit in side 2 + 1/√2. Do it in (x₁, x₂) and (x₃, x₄) at once: 5 × 5 = 25 tesseracts.

02How we found it

  1. Soften. Balls harden into cubes as the box shrinks: Yohei Nakajima's soft-to-rigid method, in any dimension.
  2. Polish. An augmented Lagrangian with L-BFGS squeezes the box under no-overlap constraints.
  3. Seed. Start from the 25-cube construction at side 2.9 and drop the extra cubes in at random.
  4. Hop. 20 threads × 10 minutes per n nudge one or two cubes and keep every improvement.

03Status: candidates

  • verifiedIn double precision: all 56 separating axes per pair, smallest gap about 10⁻¹⁰.
  • missingAn exact rational-arithmetic certificate.
  • incompleteLiterature check. We found no 4D table, so the old values are our own constructions.
  • conjectureThe closed form 2 + 2√2/3 is not derived.
The longer story: old constructions, the shape of the packings, the numbers

Where the old values come from

Erich Friedman catalogues this puzzle in 2D and 3D, and records still fall: H. Lin's 3D entries for 11 and 12 cubes date from July 2026. The 5 × 5 product gives 25 tesseracts at side 2.7071. Stacking a 3D packing in two layers along the fourth axis gives more: Friedman's 13-cube record (2.956) makes 26 cubes and his 14-cube record (2 + 7√2/10 ≈ 2.98995) makes 28. So after 25 the side jumped to 2.956, then 2.98995, then 3. The new packings land in that gap.

What the new packings look like

Sixteen cubes sit nearly axis-aligned in the corners. The rest fill the channels between them, each turned 25°–45° within one coordinate plane; one is turned in two planes at once, the 4D cousin of the 45° centre square. The corner frame opens up by about 0.24 compared with the 25-cube construction. Cubes beyond 25 sit in channels that mix one middle coordinate from (x₁,x₂) with one from (x₃,x₄), turned 45°. Four of them fit at about 2.9428 (n = 29); a fifth pushes the side to 2.9896 (n = 30).

Search details

Each pair of cubes carries its own separating direction as a free variable, so a positive gap along it proves the pair does not overlap. The C++ polish has hand-written gradients and reaches 2 + 1/√2 on the 5-square test to 10⁻¹⁰ in a third of a second; this page runs a line-for-line JavaScript port. Random starts never beat the constructions in 4D. Seeded starts gave 2.943189 (n = 26) and 2.951791 (n = 27) in the first batch of 20 seeds, and basin hopping brought both to 2.942809. For n = 28 to 30, seeds that put the extra cubes straight into those channels, one per arrangement up to the frame's 128 symmetries, did far better than random ones.

Verification numbers

An independent NumPy checker tests every pair of cubes against all 56 candidate separating directions of the 4D separating-axis theorem, then the walls and the orthogonality of each rotation. Smallest gap: 4.5 × 10⁻¹¹ (n = 26), 1.05 × 10⁻¹⁰ (n = 27), 4.2 × 10⁻¹¹ (n = 28), 3.6 × 10⁻¹⁰ (n = 29) and 2.8 × 10⁻¹¹ (n = 30). Walls are exact to rounding; rotations are orthogonal to 4 × 10⁻¹⁶. The sides match 2 + 2√2/3 to 4 × 10⁻¹⁰ (n = 26) and 2 × 10⁻⁷ (n = 27). Still missing: an exact certificate with a safety margin, like the one Nakajima produced for his 3D claim.

Leaderboard

Best known sides in 4D

Smallest known side s(n) for n unit 4-cubes. Rows 26 to 30 are our candidates; the rest are built from lower-dimensional results. Our searches for n = 31 and 32 have not gone below 3.

nside s(n)howsourcestatus
11one cubetrivialoptimal
2–1622×2×2×2 gridtrivial; no 4D optimality proof found (2D: s(2) = s(3) = 2 in Friedman's survey)believed optimal
17–252.7071072 + 1/√25-square packing in (x₁,x₂) × the same in (x₃,x₄)2D value: Friedman, Squares in Squares; our n = 17, 18 searches reach it, nothing lowerconstruction
262.942809≈ 2 + 2√2/316 corner cubes + 10 tiltedthis page; was 2.956, the 3D 13-cube record (Friedman 1998) in 2 layersnew candidate
272.942809≈ 2 + 2√2/316 corner cubes + 11 tiltedthis page; was 2.98995, the 3D 14-cube record (Friedman 1998) in 2 layersnew candidate
282.942826≈ 2 + 2√2/3?16 corner cubes + 12 tiltedthis page; was 2.98995, the 3D 14-cube record (Friedman 1998) in 2 layersnew candidate
292.942834≈ 2 + 2√2/3?25-cube frame + 4 cross-channel cubesthis page; was 3, the 3×3×3×3 gridnew candidate
302.98956825-cube frame + 5 cross-channel cubesthis page; was 3, the 3×3×3×3 gridnew candidate
31–8133×3×3×3 gridtrivial; our n = 31, 32 searches found nothing below 3construction

The 2D and 3D records underneath

Best known sides for the lower-dimensional packings used above.

dimnsidebysource
2D52.7071072 + 1/√2classical, proved optimalFriedman, Packing Unit Squares in Squares (EJC survey DS7)
3D9–102.707107E. Friedman, 1998Friedman, Cubes in Cubes
3D112.88295H. Lin (Tencent Hyra), July 2026Hyra results · announcement on X
3D112.89444earlierBerthold, Kamp, Mexi, Pokutta, Pólik, 2026Out-of-the-Box Global Optimization for Packing Problems (arXiv)
3D122.93277H. Lin (Tencent Hyra), July 2026Friedman, Cubes in Cubes
3D122.93152claimedY. Nakajima, 2026, self-reportedsoft-to-rigid-packing repository
3D132.956E. Friedman, 1998Friedman, Cubes in Cubes
3D142.9899492 + 7√2/10E. Friedman, 1998Friedman, Cubes in Cubes

4D jamming of spheres is a different problem with no cube values: Skoge, Donev, Stillinger and Torquato (2006).

Data

Take the coordinates

Each cube is a centre c ∈ ℝ⁴ and a 4×4 orthogonal R whose columns are its edges: vertices c + R·(±½, ±½, ±½, ±½), box [0, s]⁴, R row-major.

Show a packing as JSON