JANUARY 11, 2026POST BY: TEAM CODESMITHS

The “Tetris” Paradox: Why Nature is Better at Packing than Math

Why the best fit rarely looks orderly.

The “Tetris” Paradox: Why Nature is Better at Packing than Math

Why is a soda can cylindrical? Mathematically, it makes little sense. A square can would use box space with 100% utilization, while a round can leaves about 22% of a shipping truck as air gaps between circles. In an industry measured in pennies, that is a fortune.

Manufacturers are not careless. The can is the scar tissue of a battle between logistics and physics. Physics won, so efficiency moves from product design to arrangement. That is the bin packing problem.

  • 22%shipping space lost to round cans
  • 20boxes produce 2.4 quintillion arrangements
  • 77 yearsto solve 20 boxes at 1B/s
  • 40 kmDNA thread packed into a nucleus

01 14

1. The Pressure Problem

Soda is carbonated and pushes outward on its container. In a round can, that pressure becomes hoop stress distributed evenly around the wall.

In a square can, pressure pushes against flat sides until they bulge toward a circle, while stress concentrates at the sharp corners. The result is weaker, not stronger.

The pressure problem
The pressure problem

02 14

2. The Speed Limit

Metal wants to be round. A flat aluminum disk can be drawn into a cup in milliseconds. Making a square box needs folded edges and seams: slower, weaker and more expensive.

The cylinder is a hard constraint. Once the product shape cannot change, the burden of efficiency shifts from design to arrangement.

HARD CONSTRAINT

From design to arrangement

We stop asking how to design the product and start asking how to pack the truck.

03 14

3. The Combinatorial Explosion

Bin packing asks a simple question: put every item into the fewest boxes without exceeding weight or volume. It is classified as NP-hard, and the only guaranteed way to find the perfect arrangement is to check every possibility.

Five boxes have 5 factorial, or 120, arrangements. Twenty boxes produce about 2.4 quintillion. Even at one billion arrangements per second, a supercomputer would need 77 years. At 100 boxes, the heat death of the universe arrives first.

04 14

4. The Intuition Trap in 2D

If the items are identical squares, intuition says the problem becomes easy. A container of size 4 holds 16 unit squares. But what is the smallest container that holds 17?

The obvious answer, size 5, is wasteful. The true answer is only slightly larger than 4.

Two-dimensional square packing
Two-dimensional square packing

05 14

5. Calculated Chaos

In 1997, John Bidwell found the answer: not a grid, but a arrangement with squares in the middle rotated to wedge into gaps left by the outer frame.

The smallest container is about s = 4.675. Order is not always efficient; sometimes the optimal fit looks like calculated chaos.

Rotated square packing arrangement
Rotated square packing arrangement

06 14

6. Bin Packing in 1-D: Big Rocks First

To understand the logic, simplify to lines of varying lengths and fixed-length containers. Even in one dimension, the order matters enormously.

The lesson mirrors packing a jar: if you pour in sand first, the rocks no longer fit.

One-dimensional line packing
One-dimensional line packing

07 14

7. First Fit

First Fit places each item in the leftmost bin with room. It is fast and lazy, but leaves many half-empty bins because small items occupy space that larger items later need.

First Fit bin packing algorithm
First Fit bin packing algorithm

08 14

8. Best Fit

Best Fit scans open bins and chooses the one where the item fits tightest, leaving the least empty space. It improves efficiency but costs more computation per placement.

Best Fit bin packing algorithm
Best Fit bin packing algorithm

09 14

9. The Golden Rule: Sort Descending

The single most effective trick is simple: sort items from largest to smallest before packing. Small items then slide into the spaces rocks leave behind.

In simulations, sorting descending before First Fit improves efficiency by more than 20%. Shipping companies load the biggest crates first because the math of space agrees with them.

20%+

One sort, better packing

Ordering the input before applying a greedy algorithm can matter more than changing the algorithm itself.

Descending order before packing
Descending order before packing

10 14

10. The DNA Problem

Every cell contains a copy of DNA about two meters long, packed into a nucleus roughly six micrometers wide. The ratio is like fitting a 40 km thread into a tennis ball.

Nature cannot shove it in randomly, because it would tangle and break. It also cannot pack it too tightly, because the cell needs to read the code.

DNA packed inside a cell nucleus
DNA packed inside a cell nucleus

11 14

11. The Fractal Solution

In 2009, scientists discovered that nature uses a Hilbert curve: a continuous fractal line that folds through space without crossing itself.

It delivers density, with little wasted space, and locality, so DNA regions that work together sit close together in the three-dimensional ball even when far apart on the one-dimensional string.

Hilbert curve folding through space
Hilbert curve folding through space

12 14

12. How AI Solves It: Floorplanning

Chip design turned bin packing into a billion-dollar bottleneck. A modern Google TPU has billions of transistors, and engineers spent months arranging blocks to reduce wire length.

In 2021, Google trained a reinforcement-learning agent to place those blocks. Human engineers used neat Manhattan rows and columns. The agent produced scattered, alien-looking clusters.

AI floorplanning layout
AI floorplanning layout

13 14

13. Messy Layouts Win

The AI’s layout looked wrong, but it was better: lower wire length and lower power consumption. Like the DNA fractal, it found that optimal packing is not order but useful complexity.

Compare AI and conventional layouts
Compare AI and conventional layouts

14 14

14. The Price of Chaos: Why We Still Use Grids

If chaos is so efficient, why do shipping containers and Amazon warehouses still use grids? The answer is retrieval.

Nature optimizes storage density because enzymes can chemically unzip only the part of DNA they need. Humans optimize accessibility. A crumpled cargo ship would use space well, but the crate at the center would require unloading everything around it.

  • Never opened again: Pack like nature: dense, folded, chaotic.
  • Needed every morning: Pack like a human: orderly, reachable, grid-based.

Break the Grid

Humans love straight lines and associate order with efficiency. The bin packing problem shows a more nuanced universe: the soda can, the rotated squares, the DNA fractal and the AI chip layout all point to the same lesson.

The perfect fit often looks like a mess. Sometimes, to fit everything in, you have to break the grid.

Ready to build scalable, resilient, and crafted digital systems?

Solve hard arrangement problems with CodeSmiths →