Twelve Unit Cubes in a Cube of Side 2.9315,
Found by Hardening Balls into Cubes
We give a packing of 12 unit cubes in a cube of side , with every pair and every wall at least apart, improving the previous best known side (H. Lin, July 2026 (Tencent Hunyuan, n.d.)). The packing was found by a soft-to-rigid homotopy: unit-diameter balls are compressed in a shrinking box and then deformed through rounded cubes into rigid unit cubes while inward pressure on the box continues. The final configuration is tightened with a constrained solver that keeps every corner inside the box and a separating plane between every nearby pair, and validated by an exact rational certificate. On unit squares in a square, the same method recovers the best known packings for (now proved optimal), , , , and , and at equal budgets beats a rigid-start control run on the same schedule. We report where the method fails ( squares; cubes so far), an ablation in which an oriented intermediate shape showed no benefit, and code to reproduce every result.
Introduction
Let be the side of the smallest -dimensional cube that contains non-overlapping unit cubes, free to rotate. For squares () the problem has a long record history (Erdős and Graham 1975; Stromquist 2003; Friedman, n.d.b; The Squares Project, n.d.); the smallest unsettled case, , was recently closed (The Squares Project, n.d.). For cubes () far fewer results exist. Friedman’s catalogue (Friedman, n.d.a) lists non-trivial packings for – and –; the entries for and were improved in 2026 (T. Berthold et al. in March for , as credited in (Friedman, n.d.a), which gives no coordinate file; H. Lin in July for and , with coordinates published in (Tencent Hunyuan, n.d.)), and for every other the trivial packing is the best known.
Contribution.
A packing of 12 unit cubes in a cube of side with every pair and every wall separated by at least (§3), below the previous record . It is certified in exact rational arithmetic.
A simple search method, soft-to-rigid homotopy with inward pressure (§2), and an exact tightening step that turns its output into a locally optimal packing to .
An empirical record of what the method does and does not reach: in 2D it recovers six published records from random starts and beats a rigid-start control; it fails on squares; an oriented intermediate shape shows no benefit (§4, §5).
This is a search result, not an optimality proof.
Related methods.
Gensane and Ryckelynck’s perturbation–compression algorithm found dense square packings, including , from random starts (Gensane and Ryckelynck 2005). Recent square records (, , , , , , ) come from rigid simulated annealing and exact refinement (The Squares Project, n.d.). Our method differs in starting from balls and changing the shapes, not just their positions, during the search.
Method
Shape family.
A rounded cube of softness is a cube of half-side dilated by a ball of radius (the Minkowski sum). At it is a unit-diameter ball, at a unit cube, and every member lies inside the unit cube with the same centre and orientation. Hardening () therefore only grows the shapes, and the container must expand to accommodate them. The square version uses rounded squares.
Energy and pressure.
For centres , orientations (quaternions in 3D, angles in 2D) and container side , where is the signed distance between the cores (cube of half-side ): exact Euclidean distance when separated (vertex–face and edge–edge features), and minus the separating-axis penetration depth when overlapping (15 axes for cubes (Gottschalk, Lin, and Manocha 1996)). The value of is continuous where cores first touch but its gradient can jump there, so is piecewise smooth and the schedule is a search heuristic rather than a smooth homotopy. The term is inward pressure; the box resizes symmetrically so all walls push. Positions, orientations and follow momentum gradient descent with analytic gradients (checked against finite differences on random cube-pair gradient components and square-pair components, sampled away from core contact).
Schedule.
Compress balls under pressure (5,000 steps); morph linearly at pressure (45,000 steps); settle rigid cubes while decays to (3,000 steps). Optional annealing adds Gaussian kicks to positions and angles that decay to zero during compression and morphing. The rigid control runs the identical schedule with throughout. It is a within-schedule ablation, not a tuned rigid-body optimizer: the schedule was designed for soft shapes.
Legalization.
Penalty pressure tolerates small overlaps. Each run is legalized by scaling centres apart about their mean (bisection to the smallest factor at which no pair overlaps by more than under the separating-axis test) and measuring the tight bounding cube. All sides reported below are legal packings.
Exact tightening.
Runs within a threshold of the catalogue are passed to a constrained solver: minimize over centres, rotations and per-pair separating planes with (each is parameterized in the tangent plane of its current value and renormalized, so plane scale is fixed), subject to every corner of every cube lying in and the corners of and lying on opposite sides of their plane. We use SLSQP (Kraft 1988) in outer iterations with a trust region, rebuilding the pair list and re-basing rotations each iteration, and accept a step only if the independently legalized side decreases. From near-miss runs the solver converges to Trump’s (Trump 1979) and Bidwell’s (Friedman, n.d.b) to , and from a perturbed copy to Friedman’s .
Exact certificate.
For a reported 3D packing we expand centres by a factor about their mean and inflate each half-side to , which covers floating-point non-orthogonality of the axes. We convert every coordinate to an exact rational, compute all corners exactly, and check (i) every corner lies in for a rational and (ii) every pair is strictly separated by an explicit rational plane. A linear program proposes each plane; the check itself uses only exact arithmetic.
Twelve cubes
Theorem 1. Twelve unit cubes fit in a cube of side with pairwise and wall clearance at least . Hence .
Certificate. The claim file
(claims/cubincub_n12/cubincub_n12.json, Table 3) lists one pose
per cube, the format of the previous record file (Tencent Hunyuan, n.d.). It was obtained from
the tightened packing (side
,
with touching contacts) by spreading centres by a factor
until every pair is separated by
,
adding a
wall gap and rounding the side up. Two checks pass. (i) A floating-point
15-axis separating-axis test (verify.py, 30 lines): minimum
wall gap
,
minimum pair gap
.
(ii) An exact check (certify_exact.py): every number is
converted to a rational, rotations are the exactly orthogonal
,
every corner lies in
and every pair is strictly separated by an explicit rational plane.
Four cubes are exactly axis-aligned, two are tilted by less than , and six are tilted by or more (Figure 1). Several quaternions have repeated components (e.g. cube 1: ), suggesting a closed form that we have not derived.
How it was found.
Seed 52 of the first 64 ballcube starts with annealing ended at legalized side ; exact tightening lowered it to . A second start (seed 83) ended at and tightens to : a distinct local optimum, also below the catalogue. Two of 192 starts land below . Ball starts were extended from 64 to 192 after seed 52; the rigid control stayed at 32 (best ). At equal budget (seeds 1–32), 13 ballcube starts and 1 rigid start end below the trivial side 3 (one-sided Fisher ).
Other cube counts.
Table 1 summarizes the first 3D screen. The method matches Friedman’s packing often, settles in worse arrangements at and , and is the only setup that comes near the catalogue at .
| catalogue | starts (ball / rigid) | best ballcube | best rigid | matches (ball / rigid) | |
|---|---|---|---|---|---|
| 9 | 64 / 32 | 16 / 5 | |||
| 10 | 64 / 32 | 0 / 0 | |||
| 11 | 64 / 32 | 0 / 0 | |||
| 12 | 192 / 32 | — | |||
| 13 | 48 / — | — | 0 / — | ||
| 14 | 42 / — | — | 0 / — |
Validation on squares
We developed the method on unit squares, where records are dense and recently audited (The Squares Project, n.d.; Friedman, n.d.b).
.
With annealing and the long schedule, 6 of 160 random starts reach Trump’s packing (tilt ); 0 of 120 rigid-control starts do (best , median ). Trump’s packing has since been proved optimal (The Squares Project, n.d.), so this is a sanity check.
– at a fixed schedule.
Among cases whose best known packing has tilted squares, the method matches and none from upward at the standard step budget; the rigid control matches and . Grid cases split by slack: when the grid has empty cells () rigid starts fall into it more often (46–100% vs. 2–19%), while for full or nearly full grids (–) rigid starts jam at tilts they cannot rotate out of (e.g. : rigid 0/24, balls 7/48, one-sided Fisher , suggestive only).
Old records recovered with more steps and exact tightening.
| best known (finder) | recovered to | hit rate | |
|---|---|---|---|
| 17 | (Bidwell 1998) | 10/960 blob; 0/80 rigid (1/40 vs 0/40 on equal seeds) | |
| 18 | (Hämäläinen 1980) | 2/24 | |
| 19 | (Wainwright 1979) | 2/960 | |
| 26 | (Friedman 1997) | 4/160, 10/160, 10/96 at 3/5/10 steps | |
| 27 | (Göbel 1979) | 1/416 | |
| 28 | (Ellsworth 2025) | — | best |
| 29 | (Schadt 2025) | — | best |
Exact tightening matters: raw runs stop about above the record because of penalty slack, and the solver also pulls runs from up to away into the record basin (). After tightening, every arrangement within of the catalogue at and was the catalogue packing itself.
Ablations and negative results
Oriented intermediate shape.
Disks carry no orientation, and on the hit the angles lock in only once . We tested morphing through regular octagons cut back to squares, which exert torque from the start. On the same seeds and steps (, seeds 1–160), octagons hit 0/320 vs. 4/320 for annealed disks (one-sided ), with no better medians and the cost. We find no evidence that an oriented intermediate shape helps; since octagons also change the boundary geometry, this does not isolate the timing of orientation commitment.
Penalty polish.
A fixed-box squeeze-and-shake stage changed sides by at most and never changed the arrangement; it is superseded by exact tightening.
Scaling.
Hit rates fall with at a fixed budget. At they rise with hardening time; at – they do not.
Discussion
The method’s value is the basin it lands in: starting from balls, configurations are dense before orientation matters, and rotation is decided only as corners appear. For 3D, where the catalogue is sparse, this was enough to improve : 2 of 192 starts land below the record. At and (48 and 42 starts, no rigid control) no run came within and of the catalogue; the best run is the trivial side .
Limitations.
(i) No optimality claims. (ii) The catalogue values for cubes were read from Friedman’s page images, and Lin’s packings are not described in text; is truncated (“”), which does not affect a margin. (iii) Hit rates are from modest, sometimes unequal sample sizes and are reported with counts. (iv) The rigid control is an internal ablation; we did not benchmark against rigid simulated annealing or perturbation–compression (Gensane and Ryckelynck 2005). (v) Annealing noise is near zero by the time orientations lock in (); a schedule that peaks there is untested.
Reproducibility.
All code, seeds, run logs and certificates are at https://github.com/yoheinakajima/soft-to-rigid-packing,
archived as release v1.0.0 at doi:10.5281/zenodo.23248095.
scripts/reproduce_n12.sh regenerates the
packing and its certificate in a few minutes on a laptop.
Acknowledgements.
Code, experiments and verification were developed with Claude (Anthropic), an AI system, under the author’s direction. The author takes responsibility for the content.
Coordinates for
Centres and unit quaternions
;
cube
occupies
in the box
.
Full-precision values:
claims/cubincub_n12/cubincub_n12.json.
| 1 | 1.5243900087 | 2.4315173049 | 1.3320181026 | 0.5838886869 | -0.5838886869 | -0.3988408220 | -0.3988408220 |
| 2 | 2.4315175095 | 2.4315173049 | 0.5000010000 | 0.7071067812 | 0.7071067812 | -0.0000000000 | 0.0000000000 |
| 3 | 0.5000010000 | 1.4369556928 | 1.4377218077 | 0.5395289954 | 0.4570650535 | 0.4570650535 | -0.5395289954 |
| 4 | 0.5098745912 | 0.5769319953 | 2.3545775829 | 0.4560511351 | -0.5403863020 | -0.4560472394 | 0.5403896022 |
| 5 | 0.6086104699 | 2.2929309153 | 2.3887769910 | 0.0258332833 | 0.7609821302 | -0.6482073268 | -0.0081302199 |
| 6 | 2.4315175095 | 1.4315163049 | 0.5000010000 | 0.0000000000 | -0.0000000000 | -0.0000000000 | -1.0000000000 |
| 7 | 2.4298431049 | 2.4215276465 | 2.2620542416 | 0.0000269579 | 0.0016621483 | -0.9999712786 | 0.0073944948 |
| 8 | 1.5800409188 | 1.4806927085 | 2.4315175095 | 0.0000000000 | -0.9765112947 | -0.2154662186 | -0.0000000000 |
| 9 | 1.6870691741 | 0.7046058868 | 1.3931640729 | 0.1630483719 | -0.8266039691 | -0.3023204668 | 0.4458065074 |
| 10 | 0.6714203714 | 0.5125513149 | 0.5042794969 | 0.0019279356 | 0.0017767559 | -0.7100527881 | -0.7041435680 |
| 11 | 2.4315175095 | 0.5648571561 | 2.4315175095 | 0.5000000000 | -0.5000000000 | -0.5000000000 | 0.5000000000 |
| 12 | 0.5000010000 | 2.3777515563 | 0.5000010000 | 0.7071067812 | -0.7071067812 | 0.0000000000 | 0.0000000000 |