Open problems / 121

Nested boards up to iterated symmetry

A board of depth $n$ is a $2 \times 2$ board whose four squares hold boards of depth $n-1$. Two boards are the same if one becomes the other by rotating or reflecting sub-boards at any level. Kagey asks how many boards of depth $n$ there are. There are $2, 6, 231, 359026206, \dots$, every other term of A007501, and $a(n) = \lfloor 2\theta^{4^n} \rfloor$ exactly.

The boards

A board of depth $0$ is a single marker, X or O. A board of depth $n$ is a $2 \times 2$ board whose four squares hold boards of depth $n-1$. So a depth-$n$ board has $4^n$ cells, and an ordinary $2 \times 2$ board has depth $1$.

Two boards are the same if one becomes the other by rotating or reflecting sub-boards, at any level. Pick a sub-board at level $i$, apply one of the eight symmetries of the square to its four entries, and the board has not changed. On the $4^n$ cells this generates the iterated wreath product

$$W_n = D_8 \wr D_8 \wr \cdots \wr D_8 \qquad (n \text{ factors}),$$

and Kagey's question is about its orbits.

How many different boards of depth $n$ are there?

Five variants come with it. R1: $k$ kinds of marker. R2: count up to interchanging all Xs and Os. R3: nested $m \times m$ boards. R4: a different size $m_i$ at each level. R5: higher dimensions, other grids, polygons on the vertices of polygons.

==
The three depth-$2$ boards of Kagey's example, redrawn. Heavy lines cut each $4 \times 4$ array into its four sub-boards, filled squares are X and hollow squares are O. All three are the same board. Read each sub-board as its own class and every one of the three becomes the same pair of pairs. The shaded pair of sub-boards holds one X and two Xs on a diagonal, the unshaded pair holds an empty sub-board and one with three Xs.

One point of reading needs care. Turning the whole $4 \times 4$ array of a depth-$2$ board by a quarter turn is not the level-$1$ move, because it also turns each sub-board in place. It is the level-$1$ move followed by a quarter turn inside each of the four sub-boards. The two readings of the problem generate the same group, which we checked on the $16$ cells.

Sub-boards are colours

One lemma carries all of it.

Let $G$ act on $C$ and $H$ on $\Omega$, and let $E = C/G$ be the set of $G$-orbits. Then the orbits of $G \wr_\Omega H$ on $C^\Omega$ correspond bijectively to the orbits of $H$ on $E^\Omega$.

The quotient map $\pi : C \to E$ induces $\pi_* : C^\Omega \to E^\Omega$, $f \mapsto \pi \circ f$, which kills the $G$-part of the action, so it carries orbits to orbits. It is onto because $\pi$ is. For injectivity, suppose $\pi_* f' = h \cdot \pi_* f$, and let $\mathbf 1$ be the constant function $\omega \mapsto 1_G$. Then for each $\omega$ the values $f'(\omega)$ and $((\mathbf 1, h) \cdot f)(\omega)$ lie in one $G$-orbit. Choosing $\gamma(\omega) \in G$ carrying the second to the first gives $f' = (\gamma, 1)(\mathbf 1, h) \cdot f$.

In words: a class of depth-$n$ boards is an arrangement of classes of depth-$(n-1)$ boards, up to the symmetries of a single board. Classes of sub-boards behave exactly like colours, and nothing about the inside of a sub-board survives past its class. This is the orbit-level form of Pólya's theorem that the cycle index of a wreath product is the composition of the cycle indices, and it is classical. The proof above is short enough to give directly.

Write $Z_H(x_1, x_2, \dots)$ for the cycle index of $H$ on $\Omega$, the average over $h \in H$ of $\prod_l x_l^{\,j_l(h)}$ with $j_l(h)$ the number of $l$-cycles of $h$. Setting every variable to $c$ counts colourings of $\Omega$ with $c$ colours up to $H$:

$$P_H(c) = Z_H(c, c, \dots) = \frac{1}{|H|} \sum_{h \in H} c^{\,\#\text{cycles of } h}.$$

For levels $(H_1, \Omega_1), \dots, (H_n, \Omega_n)$, outermost first, and $k$ markers, the number of classes is

$$N = P_{H_1}\bigl(P_{H_2}(\cdots P_{H_n}(k) \cdots)\bigr).$$

The count at depth $n$ is the count at depth $n-1$ substituted into the polynomial that counts colourings of one board. Canonical forms come out of the same statement. Canonicalise the four sub-boards, then canonicalise the arrangement of canonical sub-boards.

For $D_8$ acting on the $m^2$ cells of the $m \times m$ board, counting the cycles of each of the eight symmetries gives

$$P_m(c) = \begin{cases} \tfrac18\bigl(c^{m^2} + 2c^{(m^2+m)/2} + 3c^{m^2/2} + 2c^{m^2/4}\bigr), & m \text{ even},\\[4pt] \tfrac18\bigl(c^{m^2} + 4c^{(m^2+m)/2} + c^{(m^2+1)/2} + 2c^{(m^2+3)/4}\bigr), & m \text{ odd}. \end{cases}$$

Two diagonals

At $m = 2$ there is extra structure, and it is what makes the sequence recognisable.

Every symmetry of the square sends diagonals to diagonals. On the four cells of the $2 \times 2$ board, $D_8$ therefore sits inside the stabiliser of the partition into the two diagonals $\{\mathrm{TL}, \mathrm{BR}\}$ and $\{\mathrm{TR}, \mathrm{BL}\}$. That stabiliser is $C_2 \wr C_2$, of order $8$, so the two groups are equal.

As a permutation group on the four cells, $D_8 = C_2 \wr C_2$ with the diagonals as blocks. A class of $2 \times 2$ boards is an unordered pair of unordered pairs of entries, and $P(c) = T(T(c))$ with $T(c) = c(c+1)/2$.

Written out, $P(c) = (c^4 + 2c^3 + 3c^2 + 2c)/8$, the doubly triangular numbers A002817.

The six classes of a $2 \times 2$ board with two markers, arranged by what sits on each diagonal. A row heading fixes one diagonal and a column heading fixes the other, and a dot sits in the two cells that are off it. Each diagonal carries an unordered pair of markers, so it has $T(2) = 3$ states, and a board is an unordered pair of those, so there are $T(3) = 6$ boards. Only the upper triangle is drawn, because the pair of diagonals is unordered as well.

Each level of nesting is thus two applications of $T$. Put $c_0 = k$ and $c_{j+1} = T(c_j)$.

The number of depth-$n$ boards with $k$ markers is $a(n) = c_{2n}$.

For $k = 2$ the chain $c_j$ is A007501, so $a(n) = \mathrm{A007501}(2n)$ and

$$a(n) = 2,\ 6,\ 231,\ 359026206,\ \dots$$

with $a(4) = 2076895351339769460477611370186681$. For $k = 3$ the chain is the same one started a step in, so $a(n) = \mathrm{A007501}(2n+1) = 3,\, 21,\, 26796,\, 64449908476890321, \dots$ For $k = 4$ it is every other term of A013589, namely $4,\, 55,\, 1186570, \dots$

Two structural facts fall out. A depth-$n$ class is a complete binary tree of height $2n$ with markers on the leaves, up to swapping the two children of any vertex, which is McKay's reading of A007501. And $|W_n| = 2^{4^n - 1}$, which by Legendre's formula is the full power of $2$ dividing $(4^n)!$, so $W_n$ is a Sylow $2$-subgroup of the symmetric group on the cells.

Exact growth

The growth is doubly exponential, and it is exact rather than asymptotic.

Let $k \ge 2$ and $v_j = (2c_j + 1)/4$. The limit $\theta_k = \lim_j v_j^{1/2^j}$ exists, and for every $j \ge 0$

$$2\theta_k^{2^j} = c_j + \tfrac12 + \delta_j, \qquad 0 < \delta_j < \frac{1}{c_j}.$$

Hence $c_j = \lfloor 2\theta_k^{2^j} \rfloor$, and $a(n) = \lfloor 2\theta_k^{4^n} \rfloor$ for every $n \ge 0$.

The substitution $v = (2c+1)/4$ turns $c \mapsto T(c)$ into $v \mapsto v^2 + 3/16$, with no linear term. That is what makes the error one-sided and small enough for the floor to be exact from $n = 0$ rather than eventually. The method is that of Aho and Sloane.

Here $\theta_2 = 1.3457681707012585263\ldots$, the constant in Kotesovec's asymptotic comment on A007501. Also $\theta_3 = \theta_2^2$ and $\theta_6 = \theta_2^4$, since those chains are shifts of the one for $k = 2$. We did not find the floor formula recorded. The bound $\delta_j < 1/c_j$ is not tight: carrying the same estimate one step further gives $c_j \delta_j \to 3/8$, so it is loose by a factor near $8/3$.

The number of decimal digits of $a(n)$ is $1, 1, 3, 9, 34, 133, 529, 2114$ for $n = 0$ through $7$.

Let $m \ge 3$, $k \ge 2$ and $N = m^2$, and let $a_m(n)$ count nested $m \times m$ boards. There is a constant $\theta_{m,k}$ with $a_m(n) = \bigl\lfloor 8^{1/(N-1)} \theta_{m,k}^{\,N^n} \bigr\rfloor$ for all $n \ge 0$.

For two markers, $\theta_{3,2} = 1.6241827761\ldots$ and $\theta_{4,2} = 1.7457363588\ldots$ At $m = 2$ that argument gives only a bounded error, which is why the sharper theorem above is needed.

Interchanging X and O

Renaming markers commutes with $W_n$, so boards up to the swap are the orbits of the swap acting on classes. Burnside gives $\tfrac12(a(n) + s(n))$, where $s(n)$ counts the classes the swap leaves alone.

Let $s_0 = 0$ and $s_{j+1} = \tfrac12(s_j^2 + c_j)$. The number of depth-$n$ classes fixed by interchanging X and O is $s(n) = s_{2n}$.

The half-step has a direct reading. An unordered pair $\{x, y\}$ of classes is fixed by the swap when both $x$ and $y$ are fixed, which gives $T(s_j)$ pairs, or when $y$ is the swap of $x$ and differs from it, which gives $\tfrac12(c_j - s_j)$ pairs.

stepcs(c + s)/20201n=01312624n=13215423123127n=2526796380635902620685598179555902n=3c(c+1)/2(s^2 + c)/2
The two chains, one step per halving of a board, so two steps per level of nesting. Column $c$ counts classes and column $s$ counts the classes that interchanging X and O leaves alone. Each $c$ is $c(c+1)/2$ of the one above it, and each $s$ draws on both entries above it. The shaded rows are the even steps, which are the depths, and the last column is the average of $c$ and $s$ there, the count up to the swap.

So $s_j = 0, 1, 2, 5, 23, 380, 85598, 3843021905, \dots$, and the counts up to the swap are $1, 4, 127, 179555902, \dots$

$n$$a(n)$up to the swapfixed by the swap
0210
1642
223112723
335902620617955590285598

The ratio $s(n)/a(n)$ tends to $0$, so the count up to the swap is asymptotic to $a(n)/2$. For odd $m$ every symmetry of the $m \times m$ board fixes the centre cell, so a class fixed by the swap would need a centre sub-board fixed by the swap, and so on down to a single marker. There is none, so the count up to the swap is exactly $a_m(n)/2$ for $n \ge 1$.

None of this is special to one swap. Take any group $S$ of marker permutations and write $F_n(\tau)$ for the number of depth-$n$ classes left alone by $\tau \in S$. Then $F_0(\tau)$ is the number of markers $\tau$ fixes, and $F_n(\tau) = Z_{H_1}\bigl(F_{n-1}(\tau), F_{n-1}(\tau^2), \dots\bigr)$ with $Z_{H_1}$ the cycle index of the outermost board. Averaging $F_n$ over $S$ gives the count up to $S$. This is de Bruijn's extension of Pólya counting carried through the wreath product. Three markers up to $S_3$ gives $1, 6, 4656, 10741653334326006$. Four markers up to $S_4$ gives $1, 7, 51475, 10324593516037810053475$. Reading X, O and empty as three markers, the $k = 3$ sequence counts partially filled boards.

Other boards

R3 and R4 need no new argument. Level-$i$ boards of size $m_i \times m_i$, outermost first, give $P_{m_1}(P_{m_2}(\cdots P_{m_n}(k)))$.

The order matters. A $2 \times 2$ board of $3 \times 3$ boards with two markers has $P_2(P_3(2)) = 13799631$ classes. A $3 \times 3$ board of $2 \times 2$ boards has $P_3(P_2(2)) = 1284066$. Nested $3 \times 3$ boards with two markers give $2,\, 102,\, 149387135539364802$, and the depth-$3$ count has $154$ digits. At depth $1$ the count $P_m(2)$ is A054247$(m)$, which runs $6, 102, 8548, 4211744, \dots$ from $m = 2$ on.

R5 has the same answer in principle, but not in closed form. Both theorems need only the permutation group of one board, so any finite permutation group can be dropped in. For markers on the vertices of an $n$-gon the one-board polynomial is the bracelet polynomial $B_n$, and polygons on the vertices of polygons are counted by $B_{n_1}(B_{n_2}(\cdots(k)))$. Pentagons on a pentagon with two markers give $B_5(B_5(2)) = B_5(8) = 3536$. For triangles $B_3(c) = \binom{c+2}{3}$. For the $2 \times 2 \times 2$ cube with its $48$ symmetries the polynomial is $(c^8 + 6c^6 + 21c^4 + 20c^2)/48$, giving $22$ at depth $1$ and $1157522542$ at depth $2$.

What is left open is one piece of R5. For an $m \times \cdots \times m$ board in dimension $D$ the recursion is settled, but the one-board polynomial is the cycle index of the hyperoctahedral group on $m^D$ cells, and we have not written that in closed form. Everything else Kagey asked is answered.

What was checked

Every number above was produced twice, once by a route that does not use the theorem being checked.

  • $D_8 \wr D_8$ was built as an explicit set of $32768$ permutations of $16$ cells. Its $2^{16}$ boards fall into $231$ classes by three computations: recursive canonical forms, union-find over the generators, and Burnside over the whole group.
  • Whole-grid turns and flips together with sub-board moves generate the same $32768$ permutations, so the two readings of the equivalence agree.
  • At depth $3$ the group has $2^{63}$ elements and cannot be listed. The cycle index is computed by plethysm instead, after checking that the depth-$2$ plethysm reproduces the cycle-type census of the explicit group, $36$ cycle types.
  • The three boards of Kagey's figure have the same canonical form, and $P_m(c)$ was checked against brute-force orbit counts for $(m, c) = (2, c \le 7)$, $(3, c \le 3)$ and $(4, 2)$.
  • The floor formulas were checked at $2600$ to $5200$ digits of precision, for $j \le 11$ at $m = 2$, and $\theta_2$ against the $56$ digits quoted in A007501.
  • The chain $c_j$ was matched term by term against A007501, and $P_m(2)$ against A054247.

The script in the repository runs all of this in under half a minute and prints one line per check, so none of the numbers here has to be taken on trust.