A classic geometry problem
Packing squares in a square
What is the smallest square that holds n squares of side 1, without overlap? A plain grid is often not the answer. Velmar Cut matched the best known side at 26 sizes where that side is not a whole number, and each comes with a picture, CAD files, the time and a check you can run yourself.
The problem
Fit n squares of side 1 into the smallest possible square, without overlap.
A plain grid is often not the best answer. Squares turned at an angle can do better, which is why these numbers look strange, with long decimals instead of whole numbers.
A plain grid: side 5
Best known: side 4.6755300936
Blue squares stand upright, orange squares are turned. Both pictures are at the same scale.
The sizes Velmar Cut matched
26 sizes where the result from Velmar Cut equals the best known value and that value is not a whole number.
| Squares | Best known side | Velmar Cut | Difference | Found by | Time to reach it | Threads |
|---|---|---|---|---|---|---|
| 5 | 2.7071067812 | 2.7071067812 | +3.700E-13 | Frits Göbel, 1979 | 0.05 s, one run | 16 |
| 10 | 3.7071067812 | 3.7071067812 | +5.700E-13 | Frits Göbel, 1979 | 0.075 s, one run | 16 |
| 11 | 3.8770835900 | 3.8770835900 | +5.800E-13 | Walter Trump, 1979 | 1.762 s, one run | 16 |
| 17 | 4.6755300936 | 4.6755300936 | +7.500E-13 | John Bidwell, 1998 | 4.838 s, one run | 16 |
| 18 | 4.8228756555 | 4.8228756555 | +8.200E-13 | Pertti Hämäläinen, 1980 | 0.471 s, one run | 16 |
| 19 | 4.8856180832 | 4.8856180832 | +8.050E-13 | Robert Wainwright, 1979 | 13.528 s, one run | 16 |
| 26 | 5.6213203436 | 5.6213203436 | +9.700E-13 | Erich Friedman, 1997 | 1.226 s, one run | 16 |
| 27 | 5.7071067812 | 5.7071067812 | +1.065E-12 | Frits Göbel, 1979 | 0.837 s, one run | 16 |
| 28 | 5.8244446167 | 5.8244446167 | +1.105E-12 | David Ellsworth, 2025 | 3238.437 s in all, several runs | 4 or more |
| 29 | 5.9338334627 | 5.9338334627 | +1.045E-12 | Thomas Schadt, optimized by David Ellsworth, 2025 | 14.006 s, one run | 16 |
| 37 | 6.5986196092 | 6.5986196092 | +1.670E-12 | David W. Cantrell, 2002 | 39.892 s, one run | 16 |
| 38 | 6.7071067812 | 6.7071067812 | +1.470E-12 | Frits Göbel, 1979 | 2.116 s, one run | 16 |
| 39 | 6.8107220831 | 6.8107220831 | +1.220E-12 | Thomas Schadt, optimized by David Ellsworth, 2026 | 1134.659 s in all, several runs | 4 or more |
| 40 | 6.8284271247 | 6.8284271247 | +1.300E-12 | Frits Göbel, 1979 | 0.166 s, one run | 16 |
| 41 | 6.9266930945 | 6.9266930945 | +1.545E-12 | Thomas Schadt, optimized by David Ellsworth, 2026 | 1660.447 s in all, several runs | 4 or more |
| 50 | 7.5714285714 | 7.5714285714 | +4.101E-12 | Thomas Schadt, optimized by David Ellsworth, 2025 | 656.624 s in all, several runs | 8 or more |
| 52 | 7.7071067812 | 7.7071067812 | +1.755E-12 | Frits Göbel, 1979 | 1.011 s, one run | 8 |
| 53 | 7.8228756555 | 7.8228756555 | +1.645E-12 | David Ellsworth, 2026 | 86.758 s, one run | 8 |
| 65 | 8.5355339059 | 8.5355339059 | +1.560E-12 | Frits Göbel, 1979 | 0.922 s, one run | 16 |
| 66 | 8.6568542495 | 8.6568542495 | +1.820E-12 | Evert Stenlund, 1980 | 15.243 s, one run | 8 |
| 67 | 8.7071067812 | 8.7071067812 | +4.083E-12 | Evert Stenlund, 1980 | 2.907 s, one run | 8 |
| 70 | 8.8816667570 | 8.8816667570 | +3.675E-12 | Joe DeVincentis, 2014 | 1089.879 s in all, several runs | 4 or more |
| 82 | 9.5355339059 | 9.5355339059 | +5.310E-12 | Frits Göbel, 1979 | 65.524 s, one run | 8 |
| 84 | 9.7071067812 | 9.7071067812 | +4.160E-12 | Evert Stenlund, 1980 | 13.482 s, one run not counting a final exactness step | 8 |
| 85 | 9.7426406871 | 9.7426406871 | +2.690E-12 | Erich Friedman, 1997 | 64.973 s, one run | 8 |
| 89 | 9.9497474683 | 9.9497474683 | +2.815E-12 | Evert Stenlund, 1980 | 96.19 s, one run | 8 |
These are the times to reach each result on one desktop PC, Intel Core i5-12600K, 10 cores, 16 threads. Each row says how many threads its run used.
Only sizes where the result from Velmar Cut equals the best known value are listed. For any other size we make no claim.
Where a plain grid is the answer
Where the best known side is a whole number, the answer is a plain grid. These sizes are trivial, so they carry no time and are not achievements of Velmar Cut.
| Side | Squares | Proved optimal |
|---|---|---|
| 1 | 1 | None credited |
| 2 | 2, 3, 4 | 2: Frits Göbel, 1979; 3: Frits Göbel, 1979 |
| 3 | 6, 7, 8, 9 | 6: Michael Kearney and Peter Shiu, 2001; 7: Erich Friedman, 1999; 8: Erich Friedman, 1999 |
| 4 | 12, 13, 14, 15, 16 | 13: Wolfram Bentz, 2009; 14: Erich Friedman, 1999; 15: Erich Friedman, 1999 |
| 5 | 20, 21, 22, 23, 24, 25 | 22: Wolfram Bentz, 2018; 23: Hiroshi Nagamochi, 2005; 24: Erich Friedman, 1999 |
| 6 | 30, 31, 32, 33, 34, 35, 36 | 33: Wolfram Bentz, 2018; 34: Hiroshi Nagamochi, 2005; 35: Erich Friedman, 1999 |
| 7 | 42, 43, 44, 45, 46, 47, 48, 49 | 46: Wolfram Bentz, 2009; 47: Hiroshi Nagamochi, 2005; 48: Hiroshi Nagamochi, 2005 |
| 8 | 56, 57, 58, 59, 60, 61, 62, 63, 64 | 62: Hiroshi Nagamochi, 2005; 63: Hiroshi Nagamochi, 2005 |
| 9 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 81 | 79: Hiroshi Nagamochi, 2005; 80: Hiroshi Nagamochi, 2005 |
| 10 | 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 | 98: Hiroshi Nagamochi, 2005; 99: Hiroshi Nagamochi, 2005 |
The proofs named are those people's theorems, not results from Velmar Cut.
Two separate questions
Whether a packing is valid and how close it comes to the best known value are different matters, and each gets its own answer.
Is the packing valid?
An exact yes or no: every piece is a unit square, every piece is inside the box, no two overlap, and the count is right. No reference value plays any part in it.
How close is it to the best known value?
A separate measurement: the difference between the side from Velmar Cut and the best known value, shown unrounded for each size. A valid packing can still fail to match.
A match: the certificate passes the exact check, and |L - best known| <= 1E-11, the difference published unrounded for each size. L is the side of the certificate's box, rounded up at 15 decimals.
You don't have to trust us
Anyone can run this with plain Python and no other software. It re-checks every result by exact rational arithmetic, with no rounding.
Download and unpack the archive, then check everything:
python verify_exact.py --records=records.json
Check one size:
python verify_exact.py 17/17-squares-in-a-square.csv --squares=17 --reference=4.67553009360455 --epsilon=1e-11
test_verify_exact.py tests the checker itself, including that it refuses rounded corners and mixed files.
What it proves
- Each piece is exactly a unit square. Each is given by its centre and t = tan(half its turn), so cos and sin are exact.
- Each piece lies inside the box of side L.
- No two pieces share interior points. Touching is allowed.
- The count is right.
- |L - reference| is within the stated epsilon.
What it does not prove
- That a packing is optimal.
- That the reference is the current best known value.
- How the layout was found.
Files
Sources
The best known values come from "Squares in Squares", David Ellsworth, from the original by Erich Friedman.
Each size names who holds its value and since when. It is their result that Velmar Cut equals.
Questions
What is the smallest square containing n unit squares?
It depends on n. For some n the best known answer is a plain grid, for others it has turned squares. The tables on this page give the side for each size.
Why do the numbers look so strange?
Turned squares bring in lengths such as ½√2, and at some sizes the side is a root of a polynomial with no tidy form at all. Written as decimals, such numbers do not end.
Do these results improve on the best known values?
No. Under the rule on this page the results from Velmar Cut equal them. The small difference shown is the side from Velmar Cut being slightly larger. It is never below the reference.
Does a match prove a packing is the smallest possible?
No. For most sizes no proof is listed. The source table marks the ones that have been proved.
Why are some sizes missing?
Only sizes where the result from Velmar Cut equals the best known value are listed. For any other size we make no claim.
Free trial
Seven days with every edition
Install Velmar Cut, enter the parts and stock of a current job and print the cutting schedule. The trial starts on first run and needs no account or card.