# Topologically distinct ways of dissecting a square into rectangles

I was asked by OEIS contributor Andrew Howroyd to post a Code Golf Challenge to extend OEIS sequence A049021.

Would be super great to get a couple more terms for [...] A049021. Kind of thing [...] team golf would excel at.

As I found out the hard way with the help of user202729, the definition of A049021 is... slippery. Instead, this challenge will have you compute a similar sequence.

(If, separate from this challenge, you're interested in computing more terms of A049021, I encourage it!)

# Definition

This challenge will have you counting topologically distinct ways of partitioning a square into $$\n\$$ rectangles.

Two partitions are called topologically distinct if there's no homeomorphism $$\A \rightarrow B\$$ with the additional property that the corners of $$\A\$$'s square map surjectively to the corners of $$\B\$$'s square. The less fancy way of saying this is that if partitions $$\A\$$ and $$\B\$$ are topologically equivalent, there is a map from $$\A \rightarrow B\$$ and a map from $$\B \rightarrow A\$$ such that all nearby points stay nearby, and every corner of $$\A\$$ is sent to a distinct corner of $$\B\$$.

Examples of homeomorphisms are rotating the square, flipping the square, and "slightly" moving the boundaries of the rectangles.

When $$\n = 4\$$ there are seven topologically distinct partitions:

As user202729 pointed out, sometimes these equivalences are somewhat surprising; in particular, the following partitions are equivalent by homeomorphism:

# Challenge

This challenge will have you write a program that computes as many terms of this new sequence as possible. In case of a close call, I will run submissions on my machine, a 2017 MacBook Pro with 8 GB of RAM.

(Be aware that some of these square partitions are more complicated then just putting two smaller partitions side-by-side.)

• I was asked by OEIS contributor Andrew Howroyd to post a Code Golf Challenge to extend OEIS sequence A049021 This must be the first time a challenge asks to write useful code – Luis Mendo Mar 1 at 23:29
• @user202729 The second and 3rd are homeomorphic, however the corner mapping cannot be surjective. The four corners of A map to only 2 corners of B. – Wheat Wizard Mar 2 at 12:58
• – Wheat Wizard Mar 2 at 15:39
• Voting to close because of the edit "as user 202729 pointed out..." It looks to me that to get from one to the other you have to slide through the point where the Northwest rectangle forms a 4-way corner with the rectangles East, South and Southeast of it. Also, if these two are equivalent, why aren't the 5th and 2nd examples for n=4 equivalent? Extend the west rectangle till it fills the whole west side, then rotate 90 deg. I think this needs clearer definition. – Level River St Mar 3 at 19:38