From one square to every rectangle
Fill a rectangular grid with . In every adjacent square, go clockwise and subtract consecutive entries. Require the four signed differences to be different. How many fillings work? Haobo Ma and Wenlin Zhang give an exact answer for every rectangle with at least two rows and two columns. The mechanism is surprisingly small: two three-vertex stars and a collection of separate edges.
For rows and columns, with , let be the actual number of fillings and use the OEIS normalization . Then
where : every other term doubles. Height and width contribute separately, by addition. The purpose of this chapter is to explain why.
This reading explains version 2 of the paper. Precise statements and proofs supplies the complete argument; Sources and further work gives the references and formalization contribution route. The original authors are Haobo Ma and Wenlin Zhang.
Subtraction has a direction
#block(breakable: false)[
Start with a single square:
]
Starting at the upper left and going clockwise gives
These four numbers differ, so the square is allowed. They are signed integer differences, rather than absolute differences or subtraction modulo . A square filled entirely with zero fails: every difference is zero.
Why are allowed squares rare? A difference can only be . The four differences add to zero because a trip around the square returns to the starting value. The five possible differences also add to zero, so the omitted value must be zero. Every allowed square therefore uses exactly . This restriction reduces the possible local fillings to eight.
The division by four is a numerical normalization in the problem. We count fillings of labelled positions; we do not identify rotations, reflections or renamed symbols. For example, a grid has eight allowed fillings, giving . The formula agrees: .
Read two rows vertically: the first two stars
Treat a column as a little card: means zero above two. Two cards may stand next to one another exactly when their square is allowed. The eight allowed squares give just these connections:
Each line is a three-vertex star: one center with two leaves. The remaining cards have no connections. An allowed two-row strip is a walk on these two stars. Each step adds a column, so steps give columns. Walking back along an edge and revisiting a card are allowed. The starting card is part of the choice.
From a star’s center, two steps mean “choose a leaf, then return to the center”: two choices. From a specified leaf, two steps mean “return to the center, then choose a leaf”: again two choices. Thus a walk of steps has possibilities across the three starting vertices. For steps, the center contributes walks and each leaf contributes , totaling .
For every positive length , the two stars together contribute walks, where
Make a whole row a vertex: wider grids add no branching
Fix the width . Now a vertex is a complete row. Join two vertices when those rows may be stacked without violating any square. Call this the row-compatibility graph . A whole grid is a walk of steps: its start gives the first row and each step adds a row. Turning local restrictions into walks is the idea behind the transfer-matrix method.
The decisive observation is that only two rows can branch, however wide the grid is. They alternate zeros and twos: at width five, they are and . The first can meet or ; the second can meet or . The two stars survive.
Any other row with a neighbor contains a . Some adjacent pair therefore involves , and the eight allowed squares uniquely determine the two entries beneath that pair. Extend left and right. Every new column has at most one choice: in the card graph above, a card’s neighbors have different upper entries. Once a small piece of the next row is fixed, the whole next row is forced. Every vertex other than the two star centers has at most one neighbor. Outside the stars, the usable graph consists of separate edges.
How many separate edges? A two-row grid read horizontally is a directed edge of ; the same grid read vertically is a -step walk in the card graph. There are directed edges altogether. The two stars use eight, and each separate edge uses two. There are therefore separate edges.
The film follows this same square, card and walk construction.
Two stars count the grids: how a local restriction determines a whole rectangle. English narration with aligned Chinese and English subtitles.
Add the two contributions
For , isolated vertices contribute no walks. The two stars contribute walks of length . Each separate edge contributes exactly two walks of any positive length, one from each end. Consequently,
At five columns, and , so there are eight separate edges. Two rows and five columns have actual fillings, giving normalized count . Three rows and five columns have , giving . Continuing produces OEIS A209723: .
Read more information from the same formula
For five columns write . Since ,
#block(breakable: false)[
The identity gives for . Subtract this identity at consecutive indices to eliminate the constant and obtain Hardin’s recurrence:
]
We can also store the sequence in a formal expression : the coefficient of records . This is a generating function. Doubling every other term gives the denominator , and adding four each time gives . Together these yield
This is an identity of formal power series: no real value of or convergence assumption is needed. Its constant term is deliberately zero; this does not extend the array formula to .
The rectangle formula also gives for three columns, so for . At these indices, if two triangle sides are specified as and , there are exactly positive integer choices for the third side: the strict triangle inequalities give an interval containing integers. Square grids give . The next chapter proves these connections with their index ranges.
The academic presentation follows the square–card–row–count progression and includes a technical appendix and speaker notes.
R. H. Hardin posed these OEIS counting problems, and Colin Barker conjectured the five-column parity formulas and generating function. Andrew gave a tile-based proof outline for four columns in 2024. This paper treats all widths through the graph decomposition. The five-column parity formulas, recurrence and formal series have a direct Lean source; this reading supplies the manuscript’s written proofs for arbitrary width and the consequences above. The paper does not address Beck’s second conjecture concerning zero positions in A309019 minus A002487, or Reverter i Bigas’s smallest-integer/divisor conjecture in A209724.