Solving the Partridge Packing Problem Using MiniZinc

Code crams “12 Days” squares into a perfect box — nerds rejoice, skeptics roll eyes

TLDR: A MiniZinc post models the Partridge Packing Problem and shows size 8 squares snapping into a perfect 36×36 box. Commenters split between delight at the neat proof and snark about “letting the computer solve it,” with memes and debates over whether solver tuning counts as real puzzle-solving.

Math meets Christmas chaos and the comments delivered. A new post shows how the Partridge Packing Problem — packing 1 tiny square, 2 slightly bigger ones, 3 bigger still, and so on — can be modeled in the solver-friendly language MiniZinc. The big twist: for size 8, all those pieces click into a 36×36 square like a perfect Tetris ending. The crowd’s mood? Equal parts “mind blown” and “okay but…why?”

Fans cheered the clean visual proof and dropped holiday memes. One joked it’s “the only time math helps with holiday packing,” while others linked Matt Parker’s video like gospel. Purists stirred drama, accusing solver users of “letting the computer do the puzzle,” while the MiniZinc faithful clapped back: this is exactly the point — computers crush combinatorial headaches. A spicy fact fueled debate: sizes 2–7 have no solution, but 8–33 do, which had some yelling “math magic” and others muttering “constraint wizardry.”

The nerdiest brawl? Search strategy. Tuning the model to try big squares first sparked “is it cheating?” threads. Meanwhile, newcomers kept it wholesome: “So cool that the total area fits but still might be impossible.” In short, the post taught, the solver solved, and the comments sang — loudly, and off-key, just how we like it.

Key Points

  • The Partridge Packing Problem packs 1×1, 2×2, …, n×n squares into a square with side length equal to the triangular number t_n = n(n+1)/2.
  • Sizes 2–7 have no solution; sizes 8–33 have at least one solution, with n=8 fitting into a 36×36 square.
  • The model uses MiniZinc with definitions for triangular_n, Parts, positions, and a reversed sizes array to prioritize larger pieces.
  • An assert enforces area equality between the sum of small squares and the large square; diffn is cited as a non-overlap constraint concept from CHIP.
  • Model improvements suggested by Mats Carlsson increased performance; parameter n can be set via instance files.

Hottest takes

"A ha!" — robbyrussell
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.