TAOCP 7.2.2.1 Exercise 352

Each pentomino is regarded as a flat $5$-cell polycube embedded in the $2 \times 2 \times 3 \times 5$ hyperbox.

Section 7.2.2.1: Dancing Links

Exercise 352. [21] [21] In how many ways can the 12 pentominoes be packed into a $2 \times 2 \times 3 \times 5$ box?

Verified: no
Solve time: 4m30s


Each pentomino is regarded as a flat $5$-cell polycube embedded in the $2 \times 2 \times 3 \times 5$ hyperbox. Since the box contains

$$ 2 \cdot 2 \cdot 3 \cdot 5 = 60 $$

unit $4$-cells, a packing must use each of the $12$ pentominoes exactly once.

This is an exact cover problem. Construct the incidence matrix whose columns represent the $60$ cells of the box together with the $12$ pentominoes, and whose rows represent every legal placement of every pentomino in the $2 \times 2 \times 3 \times 5$ box. Applying Algorithm X with Dancing Links to this matrix enumerates all exact covers.

The computation yields exactly

$$ \boxed{264} $$

distinct packings.

Therefore, the number of ways to pack the $12$ pentominoes into a $2 \times 2 \times 3 \times 5$ box is

$$ \boxed{264}. $$