The count
Each cell of the $n \times n$ grid holds one of its two diagonals, $/$ or $\backslash$. Two fillings are the same when a rotation or reflection of the square carries one to the other. Kagey gives the example $a(2) = 6$.
Count the tilings of the $n \times n$ grid up to the action of $D_8$, where the tiles are diagonals.
Five related questions come with it.
- R1. Up to rotation only.
- R2. On the torus, the cylinder, the Möbius strip.
- R3. With tiles that may carry no diagonal or both.
- R4. With black and white tiles.
- R5. Is there an obvious bijection between the two counts on the $2n \times 2n$ grid, black/white against diagonal?
The main count is $1, 6, 84, 8548, 4203520, \dots$, which is A295229. Howroyd gave the formula recorded there in 2017. Kagey and Keehn then set up Burnside counting for the $n \times m$ grid, cylinder and torus with an arbitrary set of tile designs and an arbitrary subgroup of symmetries, and their theorems contain R1 (A367531), the torus (A295223) and cylinder (A368256) parts of R2, and R3 and R4 as instances. R4 is the classical A054247.
That leaves two things. The Möbius strip, which Kagey and Keehn list as a next step and do not count. And R5, for which neither the OEIS entries nor Kagey and Keehn's paper gives a bijection. The data make the question sharp:
$$\mathrm{A295229}(n) = \mathrm{A054247}(n) \quad (n \text{ even}).$$For odd $n$ they differ. At $n = 3$ it is $84$ against $102$, and at $n = 5$ it is $4203520$ against $4211744$. What follows answers R5, gives the Möbius formula, and derives the known counts from one lemma so the page stands on its own.
One twist, all the variants
A linear isometry of the square lattice either preserves both of the lines $y = x$ and $y = -x$ or exchanges them. Write $\varepsilon(g) = 1$ in the second case. Then $\varepsilon : D_8 \to \mathbb{F}_2$ is a homomorphism. It is $1$ on the two quarter turns and the two axis reflections, and $0$ on the identity, the half turn and the two diagonal reflections. A symmetry with $\varepsilon(g) = 1$ turns every $/$ into a $\backslash$.
So symmetries do not simply permute cells. Let $T$ be a set of tile designs carrying an involution $\iota$, the effect of an exchanging symmetry on a design, and put $k = |T|$ and $k_0 = |T^\iota|$. A group $G$ with a homomorphism $\varepsilon$ acts on tilings $t : X \to T$ by
$$(g \cdot t)(gc) = \iota^{\varepsilon(g)}\bigl(t(c)\bigr).$$Call this the twisted action, and the same with $\varepsilon$ replaced by $0$ the plain action. Diagonals are $k = 2$, $k_0 = 0$. Black and white tiles are $k = k_0 = 2$, and the twist does nothing. The four designs of R3, meaning nothing, either diagonal, or both, are $k = 4$, $k_0 = 2$.
Let $H$ act on $X$ with finitely many orbits. Call an orbit twisted when the stabiliser of one of its cells contains an element with $\varepsilon = 1$. Then the number of tilings fixed by all of $H$ is $k^{a}k_0^{\,b}$, where $b$ is the number of twisted orbits and $a$ the number of the others. For $H = \langle g \rangle$ a cycle is twisted exactly when $\varepsilon(g) = 1$ and its length is odd.
A fixed tiling is determined by one value per orbit. If the stabiliser of the chosen cell contains an $s$ with $\varepsilon(s) = 1$ then that value $u$ satisfies $u = \iota u$, so it lies in $T^\iota$. Otherwise it is free. The stabiliser of a cell in a cycle of length $L$ is generated by $g^{L}$, and $\varepsilon(g^{L}) = L\,\varepsilon(g)$.
Burnside's lemma and the cycle types now give every count on the square.
For even $n$ the number of tilings of the $n \times n$ grid up to $D_8$ is
$$\tfrac18\bigl(k^{n^2} + 2k^{n(n+1)/2} + 3k^{n^2/2} + 2k^{n^2/4}\bigr),$$and for odd $n$ it is
$$\begin{aligned} \tfrac18\bigl(&k^{n^2} + 2k^{n(n+1)/2} + k^{(n^2+1)/2}\\ &\quad + 2k_0^{\,n}k^{(n^2-n)/2} + 2k_0k^{(n^2-1)/4}\bigr). \end{aligned}$$Up to $C_4$ it is $\tfrac14\bigl(k^{n^2} + k^{n^2/2} + 2k^{n^2/4}\bigr)$ for even $n$ and $\tfrac14\bigl(k^{n^2} + k^{(n^2+1)/2} + 2k_0k^{(n^2-1)/4}\bigr)$ for odd $n$.
The reflections in the two diagonals fix the $n$ cells of a diagonal and pair up the rest. The half turn pairs up everything except the centre cell when $n$ is odd. The only twisted cycles are the cells fixed by $r$, $r^3$, $h$ and $v$, and those exist only for odd $n$.
With $k = 2$, $k_0 = 0$ this is Howroyd's formula. With $k_0 = k$ it is the count of $k$-colourings, R4. With $k = 4$, $k_0 = 2$ it answers R3: for $n \le 4$ the counts are $3$, $55$, $34056$, $537157696$ up to $D_8$ and $3$, $70$, $65808$, $1073758336$ up to $C_4$.
Now read the even case again. It does not contain $k_0$ at all.
Add the checkerboard
The even formula is blind to the tile set because on an even grid the twist can be undone by relabelling the tiles cell by cell.
Let $N$ be even and let $\chi(x,y) = x + y \bmod 2$. Send a diagonal tiling to the colouring in which a cell is white when it holds $/$ and $\chi = 0$, or $\backslash$ and $\chi = 1$, and black otherwise. This map commutes with all eight symmetries. It induces a bijection between diagonal tilings up to $D_8$ and black/white colourings up to $D_8$, and likewise up to any subgroup, matching orbit sizes. In particular $\mathrm{A295229}(N) = \mathrm{A054247}(N)$ and $\mathrm{A367531}(N) = \mathrm{A047937}(N)$.
The reason is one line of arithmetic. In coordinates $0 \le x, y \le N-1$ the quarter turn is $r(x,y) = (N-1-y,\,x)$, the axis reflection is $h(x,y) = (N-1-x,\,y)$, and the diagonal reflection is $d(x,y) = (y,x)$. Since $N-1$ is odd, $r$ and $h$ change the parity of $x+y$ and $d$ keeps it. That is exactly $\chi(gc) = \chi(c) + \varepsilon(g)$, which is what a relabelling needs.
The same relabelling identifies the four designs of R3 with $4$-colourings. The relabelling is not unique. It may be changed by any function constant on cell orbits, which gives eight of them on the $4 \times 4$ grid under $D_8$ and sixteen under $C_4$.
Where it fails
The construction needs $\chi$ to exist, and there is a clean criterion for when it does.
Let a finite group $G$ act on a finite set $X$.
(a) Suppose no $g$ with $\varepsilon(g) = 1$ fixes a cell. Then there are exactly $2^{|X/G|}$ functions $f : X \to \mathbb{F}_2$ with $f(gc) = f(c) + \varepsilon(g)$, and each one makes $\Phi_f(t)(c) = \iota^{f(c)}(t(c))$ a bijection of $T^X$ carrying the twisted action to the plain action.
(b) Suppose some $g_0$ with $\varepsilon(g_0) = 1$ fixes a cell, and $\iota \neq \mathrm{id}$. Then $g_0$ fixes strictly fewer tilings under the twisted action than under the plain one, the twisted action has strictly fewer orbits, and no bijection of $T^X$ carries one action to the other.
So everything turns on whether a diagonal-exchanging symmetry fixes a cell. On an even grid the two axes run along grid lines and the rotation centre sits on a corner, so none does. On an odd grid the axes run through the middle row and column.
For odd $n$ the centre cell is fixed by every symmetry, so part (b) applies to any subgroup containing one of $r$, $r^3$, $h$, $v$, and the two counts come apart by
$$\mathrm{A054247}(n) - \mathrm{A295229}(n) = \tfrac14\bigl(2^{n(n+1)/2} + 2^{(n^2+3)/4}\bigr).$$That is $18$ at $n = 3$, which is $102$ against $84$, and $8224$ at $n = 5$, which is $4211744$ against $4203520$.
The criterion also rules out the torus and the cylinder. On the torus a quarter turn about the centre of a cell is a symmetry. On the cylinder a reflection in an axis through a column of cells is one. Both fix a cell, so neither has a relabelling, and the diagonal count stays strictly below the black/white count at every size: $4 < 6$, $18 < 26$ and $669 < 805$ at $n = 2, 3, 4$.
On the even torus the checkerboard map still does something. It does not remove the twist, it moves it onto the shifts.
Let $n$ be even. Then $\mathrm{A295223}(n)$ is the number of black/white colourings of the $n \times n$ torus under the following equivalence: two colourings are equivalent if they differ by a rotation or reflection about a vertex of the grid, by a shift by $(a,b)$ with $a+b$ even, or by a shift with $a+b$ odd followed by exchanging black and white.
The Möbius strip
The $n \times m$ cylinder has cells $\mathbb{Z}_n \times \{0, \dots, m-1\}$, so $n$ around and $m$ across. Its symmetry group has order $4n$: the shifts $\tau^a(x,y) = (x+a,\,y)$, the reflections $\rho_a(x,y) = (a-x,\,y)$, and each of those followed by the flip $v(x,y) = (x,\,m-1-y)$. Here $\varepsilon(\tau) = 0$ and $\varepsilon(v) = \varepsilon(\rho_a) = 1$. Write $C(n,m)$ for the number of diagonal tilings up to that group, which is what Kagey and Keehn compute. The Möbius strip they leave open, so we do it here.
Start from the infinite strip $S = \mathbb{Z} \times \{0, \dots, m-1\}$, which carries the same $\tau$, $v$ and $\rho_a$, and put $\sigma = \tau^n v$, the glide reflection
$$\sigma(x,y) = (x+n,\; m-1-y).$$The $n \times m$ Möbius strip is $S/\langle \sigma \rangle$. Since $\sigma$ turns a cell over, a tiling of the strip is a map $t$ on $S$ for which $t(\sigma c)$ is the diagonal opposite to $t(c)$. There are $2^{nm}$ of them. The subgroup $\langle \sigma \rangle$ is normal in the symmetry group of $S$, because $\tau$ and $v$ commute with $\sigma$ while $\rho_a \sigma \rho_a^{-1} = \sigma^{-1}$, and the quotient is dihedral of order $4n$. We count up to that group, which is the reading Kagey and Keehn's own figure suggests.
The number $M(n,m)$ of diagonal tilings of the $n \times m$ Möbius strip satisfies
$$4n\,M(n,m) = \sum_{j \mid n} \varphi(j)\,W_j \;+\; n\,2^{\lceil nm/2 \rceil},$$where
$$\begin{aligned} W_j &= [\,j \text{ odd}\,]\,2^{nm/j}\\ &\quad + [\,m \text{ even}\,]\bigl(1 + [\,j \text{ even}\,]\bigr)2^{nm/(2j)}. \end{aligned}$$Up to shifts alone the number is $\frac{1}{2n}\sum_{j \mid n} \varphi(j) W_j$.
| $M$ | $m=1$ | $2$ | $3$ | $4$ | $5$ |
|---|---|---|---|---|---|
| $n=1$ | 1 | 2 | 3 | 6 | 10 |
| $n=2$ | 1 | 4 | 10 | 39 | 136 |
| $n=3$ | 2 | 9 | 52 | 366 | 2800 |
| $n=4$ | 2 | 22 | 272 | 4179 | 65792 |
| $n=5$ | 4 | 62 | 1704 | 52740 | 1679776 |
| $n=6$ | 5 | 192 | 11056 | 700274 | 44747520 |
The rows with $n$ odd are the cylinder rows of A368256, entry for entry. The rows with $n$ even are not.
If $n$ is odd then $M(n,m) = C(n,m)$ for every $m$, and reading a tiling off the columns with even $x$ is a bijection onto the tilings of the $n \times m$ cylinder that maps orbits onto orbits. If $n$ is even then $M(n,m) < C(n,m)$, and writing $C$ and $M$ for $C(n,m)$ and $M(n,m)$,
$$\begin{aligned} 4n\,(C - M) &= \sum_{j \mid n,\ j \text{ even}} 2\varphi(j)\bigl(2^{nm/j} - [\,m \text{ even}\,]\,2^{nm/(2j)}\bigr)\\ &\quad + \bigl(1 + [\,m \text{ odd}\,]\bigr)\tfrac{n}{2}\,2^{nm/2}. \end{aligned}$$The bijection works because a tiling of the strip has period $2n$ in $x$, and when $n$ is odd every class modulo $n$ has exactly one even representative modulo $2n$, so the even columns are a fundamental domain. The shift $\tau$ on the strip becomes $\tau v$ on the cylinder, which has order $2n$ when $n$ is odd, so it and the reflection $\rho_0$ generate the cylinder group and orbits correspond. Every term of the difference formula is positive, so for even $n$ the strip has strictly fewer classes than the cylinder. At $n = 2$ the cylinder gives $2, 5, 14, 44, 152$ against $1, 4, 10, 39, 136$ on the strip, and at $n = 6$, $m = 6$ it gives $2863442960$ against $2863388380$.
What was checked
Every theorem and every number above is checked three ways: by the closed formulas, by Burnside with the fixed tilings of each symmetry counted cycle by cycle straight from the definition, and by direct orbit enumeration. The symmetries are built from geometry, a tile being a cell centre together with a segment direction, so which symmetries exchange the two diagonals is computed rather than assumed. All $43$ checks pass, and the figures on this page were generated from enumerations rather than drawn by hand.
- The main count agrees with the twelve terms listed in A295229, with Burnside for $n \le 10$, and with orbit enumeration for $n \le 4$. At $n = 5$ a pass over all $2^{25}$ tilings finds $2^{25}, 0, 2^{13}, 0, 0, 0, 2^{15}, 2^{15}$ tilings fixed by the eight symmetries, hence $4203520$.
- For $N = 2$ and $N = 4$ the checkerboard map commutes with every symmetry on every tiling, and carries the $6$, respectively $8548$, orbits onto the orbits of colourings.
- An exhaustive search over all $f : X \to \mathbb{F}_2$ in $22$ cases, squares, rectangles, tori and cylinders, finds exactly the relabellings the criterion predicts, and none on any torus or cylinder.
- For the cylinder and the Möbius strip the formulas agree with Burnside for $n \le 8$, $m \le 7$ and with enumeration for $nm \le 14$.
Two expectations failed, and the ledger in the repository records both. We expected the even torus to inherit the bijection, which the OEIS data refuted before any code ran, at $4$ against $6$. We expected a relabelling, where one exists, to be unique up to complement. There are eight on the $4 \times 4$ grid. The Möbius formula went into the script before any Möbius count had been computed and agreed on the first run.
What is not done: the Klein bottle and the projective plane, which Kagey and Keehn list but Kagey's problem does not ask for, and the tile sets of R3 and R4 on the cylinder and the Möbius strip. The fixed-point lemma covers those tile sets, so only the cycle counts are missing. The method of the Möbius theorem should carry over to the Klein bottle.