# Dividing a square into equal-area rectangles

How many ways are there to tile an $n\times n$ square with exactly $n$ rectangles, each of which has integer sides and area $n$?

The sequence $C(n)$ begins 1, 2, 2, 9, 2, 46, 2, 250, 37. Clearly $C(p) = 2$ for prime $p$. The value $C(8) = 250$ was provided to me by Sjoerd Visscher, but I cannot vouch for it personally, not having seen the details of his enumeration.

OEIS was no help.

• $C(8)=250$ is correct, but $C(9)=2\left(\binom90+\binom71+\binom52\right)+1=37$. Here's code that computes $C(n)$ up to $n=23$. (The computation for $n=24$ didn't complete after a couple of minutes.) The first terms are $1,2,2,9,2,46,2,250,37,254,2,31052,2,1480,896,306174,2,2097506,2,6025516,6638,59930,2$. (P.S.: I get a display bug in that line; the penultimate number is $59930$, without a space.) – joriki Apr 12 '12 at 7:21
• I've submitted this sequence as OEIS sequence A182106 (it's pending review). – joriki Apr 12 '12 at 8:01
• For small $n$ one can break this down to a calculation of the form $\pm k + 2\sum{n-2i\choose i}$ as in @joriki's $n=9$ example, but as $n$ increases this will stop working in many cases. – MJD Apr 13 '12 at 14:26
• The OEIS sequence has been approved and published. – joriki Apr 16 '12 at 15:30
• Some more terms, starting with $C(24)$: 22119057652, 1141, 400776, 1028162, 1205138020, 2, 188380348290, 2, 804144602282, 452036, 18524310, 103768. Calculated by the same method as @joriki but in Rust (and with some optimizations). $C(24)$ and $C(30)$ took a couple of hours. Not added to the OEIS as I do not have an account. – Pazzaz Oct 5 '19 at 6:59

$$C(p^2) = 2\left(\sum_{k=0}^{p} {p^2-k(p-1) \choose k}\right)-1$$