Skip to content

Instantly share code, notes, and snippets.

narain / sim-rect-diss.sage
Created December 19, 2022 15:43
Dissection of a square into n similar rectangles via guillotine cuts
View sim-rect-diss.sage
from dataclasses import dataclass
from typing import Any
from sage.all import *
n = 4
# A guillotine partition is a binary tree of horizontal and vertical cuts.
# In our problem each leaf node is a horizontal or vertical rectangle.
# For example, 3 vertical cuts and 4 vertical rectangles produce [ | | | ]