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.
Precise statements and proofs
Use the manuscript’s definitions. For , counts labelled arrays over . In each adjacent square , the integers must be pairwise distinct. Put and define
We state the main answer first, prove the local classification, graph decomposition and count in that order, and finish with two consequences. The written proofs below expand the arguments in Haobo Ma and Wenlin Zhang’s version 2 manuscript.
#block(breakable: false)[
For all ,
In particular, satisfies
and, as a formal power series,
]
The eight squares
Four distinct differences from sum to zero, so they must be . The and edges cannot be opposite. For example, if the top edge is and the clockwise bottom edge is , both rows are and the remaining differences are both zero; rotations cover the other positions. These edges must therefore meet at an extreme entry, or . The remaining vertex must be to supply differences and . This gives exactly eight tuples :
Direct subtraction verifies every listed square, proving sufficiency as well as necessity. The adjacency graph of column cards is exactly
In particular, different neighbors of a card have different upper entries.
Structure of the row graph
The vertices of are all rows of length ; two are adjacent if they can be stacked. Interchanging the rows permutes and negates the differences, so adjacency is symmetric. A repeated row would have two zero vertical differences, ruling out loops. An array corresponds bijectively to a walk of length with specified starting vertex. Walks may repeat edges and vertices.
#block(breakable: false)[
For every , the nonisolated part of is the disjoint union of two copies of and copies of .
]
Write , truncated to length . The card graph gives
For example, with as the upper row the first column card can only be or . The former forces the next card to be ; the latter forces because its upper entry must be . Continuing determines the two possible lower rows. Interchanging gives the other star. All six rows are distinct since .
Take any row with a neighbor. Its adjacent entries are unequal by the eight-square list. If it has no , it must be or . Otherwise an adjacent pair involves , as the row has at least two entries. In the list, upper pairs have unique lower pairs , respectively. Once that pair is fixed, extend in either direction. The next card’s upper entry is prescribed, and the current card has at most one neighbor with that upper entry. Thus the entire neighboring row is unique whenever it exists. The four displayed leaves do have neighbors, hence have degree one. Outside these stars, every nonisolated component is .
To count them, a single has walks of length : from each starting vertex. At length , the center contributes and each leaf , totaling . Thus two stars have walks of every positive length .
Reading the same two-row array by rows gives a directed edge of ; reading it by columns gives a -step walk in the card graph. This is a bijection, so has directed edges. Its two stars account for eight; each remaining accounts for two. There are such components. At this number is zero, and the argument still applies.
#block(breakable: false)[
Proof of the main formula
Apply Lemma 2.2. For isolated vertices contribute nothing, the two stars contribute walks, and each contributes two, one from each starting end. Hence
Set , so , to obtain the parity formulas. Summing the odd and even geometric series gives
Thus . The common numerator is , as asserted. Both denominator factors have constant term one and are invertible in the formal power-series ring; no analytic convergence assumption is required.
]
Exact formal scope for five columns
The following is the five-column specialization of Theorem 2.1, together with the recurrence in manuscript §3. It does not assert arbitrary-width formalization.
#block(breakable: false)[
Let , valued in the rationals. For every ,
For every ,
There exists with constant coefficient zero and coefficient at for every . Every such satisfies
]
The parity formulas follow from . The identity gives for . Subtract consecutive instances to obtain , which is the stated recurrence. Constructing the series by its coefficients gives existence, and the common-denominator calculation above gives its identity. The linked Lean theorem states all these clauses directly; its recurrence index is the same range as . Although Lean defines its count for every natural input, the series constant coefficient is specified separately as zero; it is not the array count at divided by four.
Three columns and integer triangles
Write here to distinguish it from the five-column . Manuscript Corollary 1 calls this three-column sequence .
#block(breakable: false)[
For , the three-column sequence A209721 satisfies
For ,
For , also counts nondegenerate integer triangles with two specified side lengths , meaning the number of positive integer choices for the third side.
]
Set in Theorem 2.1. Since , . The defining sequence A029744 gives , proving Beck’s first conjecture. Since for , we obtain , Peterson’s recurrence.
The parity formulas make the sequence strictly increasing: and . Put . The strict triangle inequalities for the third side are equivalent to . Hence ranges over all integers from through , giving choices. The endpoints would be degenerate and are excluded. At the first index , the specified sides are and the third side can be : five choices, agreeing with .
Square grids
#block(breakable: false)[
For every , the diagonal of A209727 satisfies
]
Set in Theorem 2.1 to obtain . At even indices this is ; at odd indices it is . These are the defining parity formulas of A027383. The array diagonal starts at with . Although A027383 also has an index-zero term, there is no shift here and no assertion about .
#block(breakable: false)[
Recurrences, series and growth at every width
These are direct substitutions in Theorem 2.1, as in manuscript §3. Put and . For fixed ,
]
#block(breakable: false)[
Thus for . Subtract consecutive instances to obtain
]
#block(breakable: false)[
At , , giving the stronger recurrence for . Also,
]
Indeed, put over a common denominator: the numerator is . Width parameters give constants , corresponding to A209721–A209726. The first column of the counting table is .
For every fixed , . In detail, is for odd and for even . As , we have . Taking th roots, the constant factors tend to one, and squeezing proves the limit. The width is fixed; this is not a claim about widths growing with .
Sources and further work
#block(breakable: false)[
Paper and earlier work
The mathematical source is Haobo Ma and Wenlin Zhang, OEIS A209723: Barker’s conjectures on distinct clockwise edge differences, version 2 (2026), version DOI: 10.5281/zenodo.23903301, licensed CC BY 4.0. The concept DOI groups the versions; citations here identify version 2. Manuscript Theorem 1 is stated in §1; Lemma 1 and the main proof are in §2; Corollaries 1–2 and the companion calculations are in §3.
]
- R. H. Hardin, A209723, the five-column problem, March 12, 2012; Colin Barker’s parity and generating-function conjectures, July 12, 2018.
- R. H. Hardin, A209727, the rectangular counting table, normalized as one quarter of the actual number of fillings.
- A209721, three columns: Barker’s generating function, Beck’s first conjecture, and Peterson’s recurrence and triangle interpretation.
- A209722, A209724, A209725, A209726, companion formulas for four and six through eight columns.
- N. J. A. Sloane, A029744, the interlaced doubling sequence; R. K. Guy, A027383, the square-grid diagonal.
- Andrew, Math Stack Exchange answer 4995628, November 8, 2024: a tile-based proof outline for four columns.
- R. P. Stanley, Enumerative Combinatorics, Volume 1, second edition, 2012, §4.7, DOI: 10.1017/CBO9781139058520, for the transfer-matrix method. This reading gives the needed walk count directly and assumes no matrix theory.
Which statements have a direct formal proof?
Theorem 2.3 corresponds directly to the five-column Lean theorem: entries are converted to integers before subtraction; the literal labelled-array count is divided by four; parity covers every positive index; the recurrence starts at four; and a formal source series exists with constant coefficient zero. The preceding chapter gives the manuscript’s written proofs of the arbitrary-width Theorem 2.1, decomposition Lemma 2.2, triangle consequence Corollary 2.4, and diagonal Corollary 2.5.
A separate three-column Lean theorem proves the order-three recurrence and formal generating function at that width. It offers reusable prerequisites for the triangle consequence, but does not directly state all its conclusions.
#block(breakable: false)[
Contribute a formalization
The remaining work is formalization of arguments already proved in the paper. Use these shared public coordination issues; translations do not need separate tasks:
- Arbitrary-width row-graph decomposition: establish the two stars and separate edges, providing the structure for the general count.
- Rectangular count and diagonal consequence: reuse the decomposition to prove the general count; obtain the diagonal by substitution in the same contribution.
- Beck–Peterson identities and triangle interpretation: reuse the general formula at three columns, or the existing three-column formal proof, for the two-step recurrence, sequence identification and third-side count.
]
State the exact intended scope and branch in the relevant issue, then submit a focused PR from your contributor fork directly to trureturing’s dev branch, following existing proof admission, review and CI rules. After acceptance, compare the frozen declaration with the complete written statement before updating citations. GitHub merge does not automatically alter independent Mathesis verification records or award platform points.
#pagebreak(weak: true)
Verification ledger
Lean-verified results correspond to frozen declarations in trureturing. Written proofs and open items are listed separately below. The table lists the Lean correspondence; links are fixed to the pinned commit, so they do not drift with upstream changes.
Formal basis: trureturing commit 8a24ea4e79de · the-omega-institute/trureturing
| Item | Title | Lean declaration | Frozen state |
|---|---|---|---|
| Theorem 2.3 | Five-column parity, recurrence and formal series | D5.S3.Combinatorics.Graph.Pressure.HardinBarkerA209723EdgeDifferences.result | 9aec6a35c9 |
Written proofs
These results cite DOI sources, book proofs and registered formalization requests. They are not kernel-verified and are excluded from LEAN ✓ counts.
- Theorem 2.1 — The rectangular count · Proof · DOI: 10.5281/zenodo.23903301 · Theorem 1 · trureturing-requests#223
- Lemma 2.2 — Decomposition of the row graph · Proof · DOI: 10.5281/zenodo.23903301 · Lemma 1 · trureturing-requests#222
- Corollary 2.4 — Three-column counts and triangles · Proof · DOI: 10.5281/zenodo.23903301 · Corollary 1 · trureturing-requests#224
- Corollary 2.5 — The square-grid diagonal · Proof · DOI: 10.5281/zenodo.23903301 · Corollary 2 · trureturing-requests#223
Open problems and conjectures
The following items are explicitly marked open; the book does not treat them as proved.
(none)