1 Introduction

The well-known \(n\)-Queens Problem asks for the number ways to place \(n\) nonattacking queens on an \(n\times n\) chessboard. No general formula is known; the answer has been computed separately for each small value of \(n\). In this article, the second of a series [2], we treat a natural generalization, the \(q\)-Queens Problem, in which both the number of queens, \(q\), and the size of the board, \(n\), vary independently. In Part I, we developed a general theory for arbitrary convex-polygonal boards with rational vertices and any chess piece \(\mathbb {P}\) with unbounded straight-line moves (known as a “rider”); this includes the queen, rook, and bishop as well as fairy chess pieces such as the nightrider, whose moves are those of a knight extended to any distance. The main result of Part I (Theorem I.4.1) is that the answer is a quasipolynomial function of \(n\), which means it is given by a cyclically repeating sequence of polynomials, and the coefficients of powers of \(n\) are essentially polynomial functions of \(q\); in fact, we found a complicated general coefficient formula. We deduced this from the theory of inside-out polytopes, which is an extension of Ehrhart’s theory of counting lattice points in convex polytopes.

Here and in later parts, we treat the square board. The self-similarity of its interior lattice points permits us to find explicit formulas for the two highest coefficients and partial formulas for the others, for arbitrary riders. Setting \(q=n\), we obtain the first known formula for the \(n\)-Queens Problem.

In Parts III, through V, we specialize to specific pieces. Part III applies the theory of Parts I and II to “partial queens,” which have a subset of the queen’s moves. We found partial queens easier to work with than other pieces with equally many moves; we also think that they make good test cases for conjectures. The main examples of partial queens are the bishop, queen, and rook, which we treat in detail along with the nightrider in Parts IV and V.

Part I serves as a general introduction to the series. Its introduction gives a fuller description of the background of our research, including the valuable hints obtained from the formulas collected and developed by Václav Kotěšovec (see [3]). We define the necessary terminology and notation from Part I; we provide a dictionary of notation to assist the reader (and authors).

Briefly (see Sect. 2 for further detail), the board consists of the integral points in the dilate \((n+1){\mathcal {B}^\circ }= (n+1)(0,1)^{2}\) of the open unit square. The associated polytope is \(\mathcal {P}= \mathcal {B}^q = [0,1]^{2q}\) with interior \(\mathcal {P}^\circ = {\mathcal {B}^\circ }^q = (0,1)^{2q}\). The inside-out polytope is \(([0,1]^{2q},\fancyscript{A}_\mathbb {P})\), where \(\fancyscript{A}_\mathbb {P}\) is an arrangement of hyperplanes determined by the moves of the piece \(\mathbb {P}\). Each hyperplane is the kernel of an expression involving two pieces. An intersection subspace is an intersection of a subset of \(\fancyscript{A}_\mathbb {P}\); the lattice of all intersection subspaces (ordered by reverse inclusion) is denoted by \(\fancyscript{L}(\fancyscript{A}_\mathbb {P})\), or by \(\fancyscript{L}(\fancyscript{A}_\mathbb {P}^q)\) when we wish to emphasize the value of \(q\), and \(\mu \) denotes its Möbius function.

The moves of \(\mathbb {P}\) are all integral multiples of vectors in a nonempty set \(\mathbf {M}\) of nonzero, nonparallel integral vectors \(m_r=(c_r,d_r) \in \mathbb {R}^2\) reduced to lowest terms (that is, \(c_r\) and \(d_r\) are relatively prime). The counting function \(u_\mathbb {P}(q;n)\) is defined as the number of nonattacking configurations of \(q\) indistinguishable copies of \(\mathbb {P}\) on the \(n \times n\) board, and \(o_\mathbb {P}(q;n)\) is the number of such configurations of \(q\) distinguishable copies. By Theorem I.4.1  \(u_\mathbb {P}(q;n)\) is a quasipolynomial function of \(n\), which we expand as

$$\begin{aligned} u_\mathbb {P}(q;n) = \gamma _0(n) n^{2q} + \gamma _1(n) n^{2q-1} + \gamma _2(n) n^{2q-2} + \cdots + \gamma _{2q}(n) n^0. \end{aligned}$$

By Ehrhart theory, the leading coefficient is \(\gamma _0(n) = 1/q!\) and the period of \(u_\mathbb {P}(q;n)\) is a divisor of the denominator \(D([0,1]^{2q},\fancyscript{A}_\mathbb {P})\), defined as the least common denominator of all coordinates of all vertices of \(([0,1]^{2q},\fancyscript{A}_\mathbb {P})\). (The denominator of a polytope alone is defined similarly.) By Theorem I.5.3  the number of unlabeled combinatorial types of nonattacking configuration equals \(u_\mathbb {P}(q;-1)\).

A trivial observation is that \(u_\mathbb {P}(1;n) = n^2\) for any piece, and with one piece there is (of course) one combinatorial type. Theorem 3.1 gives a complete solution for \(u_\mathbb {P}(2;n)\), the counting function for two copies of an arbitrary rider piece. General formulas for \(u_\mathbb {P}(q;n)\) when \(q\ge 3\) are difficult.

A computational approach to finding \(u_\mathbb {P}(q;n)\) explicitly for a particular piece is to evaluate it at enough small values of \(n\) by counting the nonattacking configurations, bounding the period \(p\) somehow (possibly by bounding the denominator \(D(\mathcal {P},\fancyscript{A}_\mathbb {P})\)), and using that information to interpolate the coefficients of the \(p\) constituent polynomials. To get a confirmed answer, \(2pq\) values of \(u_\mathbb {P}(q;n)\) must be computed. (See Sect. 8.2 for more detail.) This method becomes hard for most problems because it involves a daunting amount of computation if the period or its best known bound is large, as is usually the case. That is why we think it is important to find good bounds on the period. We find some periods here; we propose related conjectures and problems in Sect. 8.3.

Any preliminary information about \(u_\mathbb {P}(q;n)\) can reduce the number of required values. Our main result, Theorem 5.1, reduces that number by \(2p-1\) by giving a simple formula for the second coefficient, \(\gamma _1\), and proving that \(\gamma _2\) is independent of \(n\). (We reduce it by two more by noting that \(u_\mathbb {P}(q;0) = 0\) and \(u_\mathbb {P}(q;1) = \delta _{q1}\), the Kronecker delta.) The proof of Theorem 5.1 depends on the structure of the subspace Ehrhart functions developed in Sect. 4. In Sect. 6, through an explicit construction involving pieces with one move direction, we show that \(\gamma _3\) may depend on \(n\), in contrast to the constancy of \(\gamma _0\), \(\gamma _1\), and \(\gamma _2\).

Our formula for the \(n\)-Queens Problem (Sect. 7) is an immediate corollary of Theorem 5.1. It is not clear how practical this formula is, as it has infinitely many terms (though only finitely many for each \(q\)) that become harder and harder to evaluate, but it is precise and complete and shows a clear structure from which it may be possible to deduce interesting consequences—which we do not attempt to do here.

We conclude with open problems, of which one, dealing with recurrences satisfied by \(u_\mathbb {P}(q;n)\) for fixed \(q\) (Sect. 8.2), promises to be superbly important.

2 Preliminaries

We adopt the concise notation \([n] := \{1,\ldots ,n\}\) so that the set of points representing the squares of an \(n \times n\) chessboard is

$$\begin{aligned}{}[n]^2 = (n+1)(0,1)^{2}\cap \mathbb {Z}^2. \end{aligned}$$

The hyperplane representing an attack between pieces \(\mathbb {P}_i\) and \(\mathbb {P}_j\), located at \(z_i=(x_i,y_i)\) and \(z_j=(x_j,y_j)\), in the direction of the basic move \(m=(c,d)\), i.e., along slope \(d/c\), is \(\mathcal {H}^{d/c}_{ij}=\mathcal {H}^{d/c}_{ji}\). Its defining equation is \(d(x_j-x_i)=c(y_j-y_i)\). The precise definition of the move arrangement is

$$\begin{aligned} \fancyscript{A}_\mathbb {P}:= \{ \mathcal {H}^{d/c}_{ij} : (c,d)\in \mathbf {M}, \ 1\le i < j \le q \}. \end{aligned}$$

The Ehrhart quasipolynomial of a rational convex polytope \(\mathcal {P}\) is \(E_\mathcal {P}(n+1):=\) the number of integral lattice points in the dilate \((n+1)\mathcal {P}\). The open Ehrhart quasipolynomial of \(\mathcal {P}\) is \(E_\mathcal {P}^\circ (n+1):=\) the number of integral points in the interior \((n+1)\mathcal {P}^\circ \). The open Ehrhart quasipolynomial of an inside-out polytope \((\mathcal {P},\fancyscript{A})\) is \(E_{\mathcal {P},\fancyscript{A}}^\circ (n+1):=\) the number of integral points in \((n+1)\mathcal {P}^\circ \) that are not in any hyperplane of \(\fancyscript{A}\).

We introduce a short notation for a frequently recurring quantity. For \(\mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P})\), let \(\kappa \) be the number of pieces involved in the equations that determine \(\mathcal {U}\) and let \(\widetilde{\mathcal {U}}\) be the essential part of \(\mathcal {U}\), i.e., the subspace of \(\mathbb {R}^{2\kappa }\) that satisfies the same attack equations as \(\mathcal {U}\). The “reduced” open Ehrhart quasipolynomial of \(\mathcal {U}\) is

$$\begin{aligned} \alpha (\mathcal {U};n):=E_{(0,1)^{2\kappa }\cap \widetilde{\mathcal {U}}}(n+1). \end{aligned}$$

The actual open Ehrhart quasipolynomial is \(\alpha (\mathcal {U};n)n^{2q-2\kappa }\).

Subspaces \(\mathcal {U}_1,\mathcal {U}_2 \in \fancyscript{L}(\fancyscript{A}_\mathbb {P})\) are isomorphic if the \(q\) copies of \(\mathbb {P}\) can be relabeled so that one subspace becomes the other. The type \([\mathcal {U}]\) of \(\mathcal {U}\) is its isomorphism class. For instance, \([\mathcal {H}_{12}^{2/1}]=[\mathcal {H}_{25}^{2/1}]\ne [\mathcal {H}_{12}^{1/2}]\). The relabelling is an isomorphism. The group of automorphisms of \(\mathcal {U}\) is denoted by \(\mathrm{Aut }\mathcal {U}\).

3 Two pieces

We examine an exceedingly small number of pieces, i.e., \(q=2\). There is a (relatively) simple way to calculate \(u_\mathbb {P}(2;n)\). Define \(a_\mathbb {P}(2;n)\) to be the number of attacking configurations of two labeled pieces \(\mathbb {P}\) (which may occupy the same position; that is considered attacking). Then

$$\begin{aligned} u_\mathbb {P}(2;n) = \frac{1}{2!} o_\mathbb {P}(2;n) = \frac{1}{2} \big [ n^4 - a_\mathbb {P}(2;n) \big ]. \end{aligned}$$
(3.1)

Finding \(a_\mathbb {P}(2;n)\) is easy in principle although nontrivial in detail. (See Eq. (3.7).) To begin with, consider a move \((c,d) \in \mathbf {M}\), whose slope is the rational fraction \(d/c\), and let

$$\begin{aligned} l^{d/c}(b) := \hbox {the line in }\mathbb {R}^2\, \hbox {with slope } d/c \hbox { and } y\hbox {-intercept } b. \end{aligned}$$

We allow \(d/c=1/0 = \infty \), in which case \(b\) is instead the \(x\)-intercept. Define

$$\begin{aligned} l_{\mathcal {B}}^{d/c}(b) := l^{d/c}(b) \cap [n]^2, \end{aligned}$$

the set of positions on the \(n \times n\) board \([n]^2\) that lie on the line \(l^{d/c}(b)\). The multiset of line sizes,

$$\begin{aligned} \mathbf {L}^{d/c}(n):=\big \{|l_{\mathcal {B}}^{d/c}(b)| : l_{\mathcal {B}}^{d/c}(b)\ne \varnothing \big \}, \end{aligned}$$

is finite, and the sum of its entries is \(n^2\). We need to know the exact contents of \(\mathbf {L}^{d/c}(n)\). Two cases are elementary:

$$\begin{aligned} \begin{aligned} \mathbf {L}^{0/1}(n) =&\, \mathbf {L}^{1/0}(n) = \{ n^{n} \}, \\ \mathbf {L}^{1/1}(n) =&\, \mathbf {L}^{-1/1}(n) = \{ 1^2, 2^2, \ldots , (n-1)^2, n^1 \}. \end{aligned} \end{aligned}$$

Lemma 3.1

Assume \(0 < c \le d\) are relatively prime integers. Let \({\bar{n}}:=(n\, \mathrm{mod }\, d)\). The multiplicities of line sizes in \(\mathbf {L}^{d/c}(n)\) are as in the following table:

Proof

Let \(\delta := \lfloor n/d\rfloor = (n-{\bar{n}})/d\); note that \(\delta \le \lfloor n/c\rfloor \).

Each nonempty line \(l_{\mathcal {B}}^{d/c}(b)\) has a lowest point

$$\begin{aligned} (x,y) \in Z := \{(x,y) \in [n]^2: x \le c \text { or } y \le d\}, \end{aligned}$$

and conversely, each point in \(Z\) is the lowest point of a different line \(l_{\mathcal {B}}^{d/c}(b)\). If we rename the line \(l_{\mathcal {B}}(x,y)\), then the naming is unique and the points on \(l_{\mathcal {B}}(x,y)\) are the points of the form \((x,y)+k(c,d)\) for \(k=0,\ldots ,\bar{k}\), where \(\bar{k}\) is the largest integer such that \((x,y)+\bar{k}(c,d) \in [n]^2\). Solving this last restriction for \(\bar{k}\), we find that

$$\begin{aligned} x\le n \implies \bar{k} \le (n-x)/c \text { and } y \le n \implies \bar{k} \le (n-y)/d. \end{aligned}$$

Hence, \(\bar{k} = \min \big ( \lfloor (n-x)/c\rfloor , \lfloor (n-y)/d\rfloor ).\)

In order to calculate the cardinality of a line \(l_{\mathcal {B}}(x,y)\) for \((x,y)\in Z\), we pick out special subrectangles in \([n]^2\) (illustrated in Figure 1). First are the lower and left borders:

$$\begin{aligned} I := \{ (x,y) \in [n]^2 : y \le d \}, \quad J := \{ (x,y) \in [n]^2 : x \le c \}. \end{aligned}$$

Define new \(c \times d\) rectangles on the bottom edge, from right to left,

$$\begin{aligned} I_i := \{ (x,y)\in I : n-ci < x \le n-c(i-1) \} \quad \mathrm { for }\,\, i=1,\ldots ,\delta , \end{aligned}$$

and on the left edge, from the top down,

$$\begin{aligned} J_j := \{ (x,y)\in J : n-dj < y \le n-d(j-1) \} \quad \mathrm { for }\,\, j=1,\ldots ,\delta . \end{aligned}$$

Thus, \(I_1\) occupies the bottom right corner of \([n]^2\), and \(J_1\) occupies the top left corner of \([n]^2\). Also, \(J_\delta \) occupies the upper half of the left end of \(I\).

Fig. 1
figure 1

The division of \([n]^2\) into the shaded border region \(Z\), with its subdividing rectangles, and the remainder of the board. (The illustration shows the case where \(I_\delta \) and \(J_\delta \) do not overlap.)

Then, subdivide the remainder of \(Z\) (that is, the part of \(I\) to the left of \(I_\delta \) and not in \(J_\delta \)) into lower and upper halves:

$$\begin{aligned} I^-&:= \{ (x,y) \in I : y \le {\bar{n}}, \ 1 \le x \le n-c\delta \}, \\ I^+&:= \{ (x,y) \in I : y > {\bar{n}}, \ c+1 \le x \le n-c\delta \}. \end{aligned}$$

There is a critical value of \(x\), namely \(n-c\delta ,\) such that \(\bar{k} = \lfloor (n-x)/c\rfloor \) if \(x > n-c\delta \) and \(\bar{k} = \lfloor (n-y)/d\rfloor \) if \(x \le n-c\delta \). Hence, we know the size of any line by the formula

$$\begin{aligned} |l_{\mathcal {B}}(x,y)| = \bar{k} + 1 = {\left\{ \begin{array}{ll} \delta +1, &{}\quad \text {if } (x,y) \in I^-,\\ \delta , &{}\quad \text {if } (x,y) \in I^+,\\ i, &{}\quad \text {if } (x,y) \in I_i \quad \mathrm { for } \,\, { i} \le \delta , \\ j, &{}\quad \text {if } (x,y) \in J_j \quad \mathrm { for } \,\,{ j} \le \delta . \end{array}\right. } \end{aligned}$$
(3.2)

From Eq. (3.2) we can write down the multiplicities of all line sizes in the multiset \(\mathbf {L}^{d/c}(n)\) by counting the base points \((x,y)\) in each case. We obtain the multiplicities stated in the lemma.

The rectangles \(I_\delta \) and \(J_\delta \) do not overlap if and only if the left end of \(I_\delta \), at \(x=n-c\delta +1\), is to the right of the right edge of \(J_\delta \), at \(x=c\); that is, if and only if \(n-(c+1)\delta \ge 0\); equivalently, \(\delta = \lfloor n/c \rfloor \). As the width of \(I^+\) is exactly \((n-c\delta )-c\), if there is overlap then \(I^+\) is the overlap and has negative width, so our computation subtracts exactly the amount necessary to correct for double counting of the lines based at \((x,y) \in I_\delta \cap J_\delta \). (In this case \(I^+ := \{ (x,y) \in I : y > {\bar{n}}, \ c \ge x > n-c\delta \}\).) Thus, our formula works whether or not overlap occurs.\(\square \)

Now, define \(\alpha ^{d/c}(n)\) to be the number of ordered pairs of positions that attack each other along slope \(d/c\). Thus,

$$\begin{aligned} \alpha ^{d/c}(n) := \alpha (\mathcal {H}^{d/c}_{12};n) = E_{(0,1)^4\cap \mathcal {H}_{12}^{d/c}}(n+1), \end{aligned}$$

the open Ehrhart quasipolynomial of the subpolytope \([0,1]^4 \cap \mathcal {H}_{12}^{d/c}\) of \([0,1]^4\) that satisfies the equation of attack, \((z_2-z_1) \cdot (d,-c) = 0\), of \(\mathcal {H}_{12}^{d/c}\). Counting attacking pairs of positions shows that

$$\begin{aligned} \alpha ^{d/c}(n) = \sum _{l \in \mathbf {L}^{d/c}(n)} l^2. \end{aligned}$$

The subpolytope is 3-dimensional so the degree of \(\alpha ^{d/c}(n)\) is 3; therefore its leading coefficient is the relative volume of \([0,1]^4 \cap \mathcal {H}_{12}^{d/c}\). Similarly, the number of ordered triples that are collinear along slope \(d/c\) is

$$\begin{aligned} \beta ^{d/c}(n) := \alpha (\mathcal {W}^{\,d/c}_{123};n) = E_{(0,1)^6\cap \mathcal {W}^{\,d/c}_{123}}(n+1) = \sum _{l \in \mathbf {L}^{d/c}(n)} l^3, \end{aligned}$$

where \(\mathcal {W}^{\,d/c}_{ijk\ldots } := \mathcal {H}^{d/c}_{ij} \cap \mathcal {H}^{d/c}_{jk} \cap \cdots \), the subspace in which \(\mathbb {P}_i,\mathbb {P}_j,\mathbb {P}_k,\ldots \) attack each other along slope \(d/c\). The leading coefficient is the relative volume of \([0,1]^6\cap \mathcal {W}^{\,d/c}_{123}\).

The values of \(\alpha ^{d/c}(n)\) et al. have to be computed for each slope. Two easy examples are

$$\begin{aligned} \qquad \alpha ^{0/1}(n) = \alpha ^{1/0}(n)&= n^3,&\alpha ^{\pm 1/1}(n) = \sum _{i=1}^n i^2 + \sum _{i=1}^{n-1} i^2&= \frac{2n^3+n}{3}. \end{aligned}$$
(3.3)

and

$$\begin{aligned} \beta ^{0/1}(n) = \beta ^{1/0}(n) = n^4, \qquad \qquad \quad \beta ^{\pm 1/1}(n) = \frac{n^4+n^2}{2}. \end{aligned}$$
(3.4)

There are general formulas.

Proposition 3.1

For relatively prime integers \(c\ge 0\) and \(d>0\) with \(c \le d\), let \({\bar{n}}:=(n\, \mathrm{mod }\, d) \in \{0,1,\ldots ,d-1\}\). The number of ordered pairs of positions that attack each other along lines of slope \(d/c\) is

$$\begin{aligned} \begin{aligned} \alpha ^{d/c}(n) =&\ \bigg \{ \frac{3d-c}{3d^2}\, n^3 + \frac{c}{3}\, n \bigg \} + \frac{{\bar{n}}(d-{\bar{n}})}{d^2} \bigg \{ (d-c) n - \frac{c(d-2{\bar{n}})}{3} \bigg \}. \end{aligned} \end{aligned}$$
(3.5)

The period of this quasipolynomial is \(d\).

The number of ordered triples of positions that attack each other along a single line of slope \(d/c\) is

$$\begin{aligned} \begin{aligned} \beta ^{d/c}(n)&\;= \bigg \{ \frac{2d-c}{2d^3}\, n^4 + \frac{c}{2d}\, n^2 \bigg \}\\&\qquad + \frac{{\bar{n}}(d-{\bar{n}})}{d^3} \bigg \{ 3(d-c) n^2 - (d-2c)(d-2{\bar{n}}) n + \frac{3c{\bar{n}}(d-{\bar{n}})}{2} \bigg \}. \end{aligned} \end{aligned}$$
(3.6)

The period of this quasipolynomial is \(d\).

Each of these quasipolynomials has an invariant part (in the first set of braces), which is independent of \({\bar{n}}\), i.e., of the residue class of \(n\), and a periodic part (in the second set of braces), which depends on \({\bar{n}}\). When \(n\) is a multiple of \(d\), then \({\bar{n}}=0\), and the equations reduce to the invariant part.

If the degree is \(e\) (which is 3 for \(\alpha ^{d/c}\) and 4 for \(\beta ^{d/c}\)), then the coefficients \(\bar{\zeta }_{e-i}({\bar{n}})\) of \(n^{e-i}\) of the periodic part have the alternating symmetry \(\bar{\zeta }_{e-i}(d-{\bar{n}}) = (-1)^i\bar{\zeta }_{e-i}({\bar{n}})\). For instance, in Eq. (3.5), \(e=3\) and the periodic part of the coefficient of \(n\) (i.e., \(i=2\)) is \(\frac{{\bar{n}}(d-{\bar{n}})}{d^2} (d-c)\), which is invariant under the mapping \({\bar{n}}\mapsto d-{\bar{n}}\) (for \(1\le {\bar{n}}\le d\)). That is, for any \(k \in \mathbb {Z}_{>0}\) and any \({\bar{n}}= 1,2,\ldots ,d-1\), \(\bar{\zeta }_i(kd+{\bar{n}}) = \bar{\zeta }_i(kd+(d-{\bar{n}}))\) for all \(i\).

The fact that there is no second leading term will be important in examples.

Proof

The number of attacking pairs is the sum over all lines with slope \(d/c\) of \(|l_{\mathcal {B}}^{d/c}(b)|^2\). From Lemma 3.1, we can write out the total number:

$$\begin{aligned} \alpha ^{d/c}(n) = 2cd \sum _{l=1}^{\delta -1} l^2 + [cd+c{\bar{n}}+(d-{\bar{n}})(n-c\delta )] \delta ^2 + [{\bar{n}}(n-c\delta )] (\delta +1)^2, \end{aligned}$$

which simplifies to Eq. (3.5) after eliminating \(\delta \) via \(\delta = (n-{\bar{n}})/d\).

If \(c<d\), then the period \(d\) follows from examining the coefficient of \(n\), which equals \(c/3\) only when \({\bar{n}}=0\). If \(c=d\), then both equal 1, and the period is \(d=1\).

The computation for attacking triples is similar. The total number of such triples is

$$\begin{aligned} \beta ^{d/c}(n) = 2cd \sum _{l=1}^{\delta -1} l^3 + [cd+c{\bar{n}}+(d-{\bar{n}})(n-c\delta )] \delta ^3 + [{\bar{n}}(n-c\delta )] (\delta +1)^3, \end{aligned}$$

which simplifies to Eq. (3.6). The constant term has period exactly \(d\). The \(n^1\) term also has period \(d\), because when \(c=d\), both \(c\) and \(d\) must equal \(1\) since they are relatively prime.\(\square \)

For the piece \(\mathbb {P}\), we have the formula

$$\begin{aligned} a_\mathbb {P}(2;n) = \sum _{(c,d) \in \mathbf {M}} \alpha ^{d/c}(n) - (|\mathbf {M}|-1)n^2 , \end{aligned}$$
(3.7)

which is the sum over all moves \((c,d) \in \mathbf {M}\) of the number of placements of two labeled pieces that attack along that direction, reduced by the overcount of two pieces on the same square, which should be counted only once per square. By Eq. (3.1),

$$\begin{aligned} u_\mathbb {P}(2;n) = \frac{1}{2!} o_\mathbb {P}(2;n) = \frac{1}{2} \Big [ n^4 - \sum _{(c,d) \in \mathbf {M}} \alpha ^{d/c}(n) + (|\mathbf {M}|-1)n^2 \Big ], \end{aligned}$$
(3.8)

the number of placements of two labeled pieces that do not attack each other. Then by Proposition 3.1, we have an explicit formula for \(u_\mathbb {P}(2;n)\).

Theorem 3.1

For \((c,d)\in \mathbf {M}\), let \({\hat{c}}:= \min (|c|,|d|)\), \({\hat{d}}:= \max (|c|,|d|)\), and \({\bar{n}}:= (n \, \mathrm{mod }\, {\hat{d}}) \in \{0,1,\dots ,{\hat{d}}-1\}\). On the square board,

$$\begin{aligned} \begin{aligned} u_\mathbb {P}(2;n)&= \frac{1}{2!} o_\mathbb {P}(2;n) \\&= \frac{1}{2} n^4 - \frac{1}{6} \sum _{r=1}^{|\mathbf {M}|} \frac{3{\hat{d}}_r-{\hat{c}}_r}{{\hat{d}}_r^2} n^3 + \frac{|\mathbf {M}|-1}{2} n^2 - \frac{1}{6} \sum _{r=1}^{|\mathbf {M}|} {\hat{c}}_r n \\&\quad - \frac{1}{2} \sum _{r=1}^{|\mathbf {M}|} \frac{{\bar{n}}_r({\hat{d}}_r-{\bar{n}}_r)({\hat{d}}_r-{\hat{c}}_r)}{{\hat{d}}_r^2} n + \frac{1}{3} \sum _{r=1}^{|\mathbf {M}|} \frac{{\hat{c}}_r({\hat{d}}_r-{\bar{n}}_r)({\hat{d}}_r - 2{\bar{n}}_r){\bar{n}}_r}{{\hat{d}}_r^2}. \end{aligned} \end{aligned}$$

The period of \(u_\mathbb {P}(2;n)\) is \(\Lambda :=\mathrm{lcm }\{{\hat{d}}_r: 1\le r \le |\mathbf {M}|\}\).

Proof of the period bound

Term \(r\) in the penultimate summation has period \({\hat{d}}_r\); the term equals 0 only when \({\bar{n}}_r=0\). Otherwise, the term is positive. It follows that the sum is 0 only when \(n\) is divisible by every \({\hat{d}}_r\). The final summation similarly has period dividing \(\Lambda \).\(\square \)

Notice that the three highest terms are independent of the residue class of \(n\).

Corollary 3.1

The number of combinatorial types of nonattacking configuration of two pieces is the number of basic moves.

Proof

We already proved this geometrically in Proposition I.5.6; therefore, evaluating \(u_\mathbb {P}(2;-1)\), which is the number of types by Theorem I.5.3, checks the correctness of Theorem 3.1. We omit the computation, noting only that \({\bar{n}}_r={\hat{d}}_r-1\), and the result is \(|\mathbf {M}|\), as it should be.\(\square \)

4 Coefficients of subspace Ehrhart functions

The more we can say about the open Ehrhart quasipolynomials \(\alpha (\mathcal {U};n)\) of subspaces, the more we can infer about the configuration counting functions.

4.1 Odd and even functions

The square board has a property that few other boards share (an isosceles right triangle with a side parallel to an axis being one that does). We remind the reader that a function \(f(n)\) of an integer \(n\) is called even or odd if it satisfies \(f(-n)=f(n)\) or, respectively, \(f(-n)=-f(n)\).

Theorem 4.1

(Parity Theorem) Consider the square board with any piece \(\mathbb {P}\). Let \(\mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P})\). The function \(\alpha (\mathcal {U};n)\) is an odd function of \(n\) if \(\dim \mathcal {U}\) is odd and an even function if \(\dim \mathcal {U}\) is even.

Proof

The crucial property of the square board that makes the theorem true is that the interior lattice points, \((n+1)(0,1)^2\cap \mathbb {Z}^2\), are isomorphic to all the lattice points, \((n-1)[0,1]^2\cap \mathbb {Z}^2\), by a translation.Footnote 1 The equations of the attack hyperplanes are invariant under that translation, so the two sets of lattice points are equivalent for the inside-out Ehrhart theory of \(([0,1]^{2q},\fancyscript{A}_\mathbb {P})\). Therefore,

$$\begin{aligned} \alpha (\mathcal {U};n) := E_{(0,1)^{2q}\cap \widetilde{\mathcal {U}}}(n+1) = E_{[0,1]^{2q}\cap \widetilde{\mathcal {U}}}(n-1). \end{aligned}$$

Because every \(\mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P})\) meets the open hypercube, \((0,1)^{2q}\cap \widetilde{\mathcal {U}}= ([0,1]^{2q}\cap \widetilde{\mathcal {U}})^\circ \), and both have dimension \(\dim \widetilde{\mathcal {U}}\). Therefore, \(E_{(0,1)^{2q}\cap \widetilde{\mathcal {U}}}(t) = E_{[0,1]^{2q}\cap \widetilde{\mathcal {U}}}^\circ (t).\) By Ehrhart reciprocity,

$$\begin{aligned} E_{[0,1]^{2q}\cap \widetilde{\mathcal {U}}}(n-1)&= (-1)^{\dim \widetilde{\mathcal {U}}} E_{[0,1]^{2q}\cap \widetilde{\mathcal {U}}}^\circ (-(n-1)) \!=\! (-1)^{\dim \widetilde{\mathcal {U}}} E_{[0,1]^{2q}\cap \widetilde{\mathcal {U}}}^\circ (-n+1) \\&= (-1)^{\dim \widetilde{\mathcal {U}}} E_{(0,1)^{2q}\cap \widetilde{\mathcal {U}}}(-n+1) = (-1)^{\dim \mathcal {U}} \alpha (\mathcal {U};-n). \end{aligned}$$

Since \(\dim \mathcal {U}\equiv \dim \widetilde{\mathcal {U}}\, \mathrm{mod }\, 2\), that concludes the proof.\(\square \)

Oddness or evenness of \(\alpha (\mathcal {U};n)\) should not be confused with that of its constituent polynomials. The correct constituent properties are the following. Let \(p(\mathcal {U})\) denote the period of \(\alpha (\mathcal {U};n)\).

Corollary 4.1

(Constituent Parity) The constituent \(\alpha _0(\mathcal {U};n)\) is an odd function of \(n\) if \(\dim \mathcal {U}\) is odd and an even function if \(\dim \mathcal {U}\) is even. If \(p(\mathcal {U})\) is even, then the middle constituent \(\alpha _{p(\mathcal {U})/2}(\mathcal {U};n)\) is also odd or even, respectively. For \(i\in [p(\mathcal {U})-1]\), there is the relation \(\alpha _{p(\mathcal {U})-i}(\mathcal {U};n) = (-1)^{\dim \mathcal {U}}\alpha _i(\mathcal {U};-n).\)

Thus, if the period is 2, indeed each constituent is an odd or even polynomial, but that is not necessarily so for any larger period. For example, the contribution of a hyperplane is \(\alpha (\mathcal {H}^{d/c}_{12};n) = \alpha ^{d/c}(n)\), given by Eq. (3.5), with period \(d\). When \(d\le 2\), we get an odd polynomial in \(n\) but since \(d>2\) gives a nonzero constant term, the polynomial is no longer odd.

The preceding corollary can be strengthened by focussing on individual terms. Let \(\mathcal {U}\) involve \(\kappa \) pieces and have codimension \(\nu \), and write

$$\begin{aligned} \alpha (\mathcal {U};n) := \sum _{j=0}^{2\kappa -\nu } \bar{\gamma }_j(\mathcal {U})n^{2\kappa -\nu -j} \end{aligned}$$
(4.1)

and define \(p_j(\mathcal {U})\) to be the (smallest) period of \(\bar{\gamma }_j(\mathcal {U})\), which may be less than the period \(p(\mathcal {U})\) of \(\alpha (\mathcal {U};n)\) (indeed, the latter equals \(\mathrm{lcm }_j p_j(\mathcal {U})\)). Thus, \(\bar{\gamma }_j(\mathcal {U})\) cycles through the functions \(\bar{\gamma }_{0j}(\mathcal {U}),\ldots ,\bar{\gamma }_{p_j(\mathcal {U}),j}(\mathcal {U})\). If \(p(\mathcal {U})>p_j(\mathcal {U})\), then \(\bar{\gamma }_{ij}(\mathcal {U})\) cycles through more than one period as \(\alpha _i(\mathcal {U};n)\) goes through one of its periods. (Notational note: We employ \(\gamma _i\) for coefficients of an unlabeled counting function \(u_\mathbb {P}(q;n)\) and \(\bar{\gamma }_i\) for a coefficient of a labeled counting function \(o_\mathbb {P}(q;n)\) or \(\alpha (\mathcal {U};n)\).)

Corollary 4.2

(Coefficient Parity) Let \(0\le i<p_j(\mathcal {U})\). The constituents of \(\bar{\gamma }_j(\mathcal {U})\) satisfy \(\bar{\gamma }_{p_j(\mathcal {U})-i,\,j}(\mathcal {U}) = (-1)^{\dim \mathcal {U}-j}\bar{\gamma }_{ij}(\mathcal {U}).\)

Assume \(j \not \equiv \dim \mathcal {U}\;(\mathrm{mod }\;2)\); then \(\bar{\gamma }_{0j}(\mathcal {U})=0\) and (if \(p_j(\mathcal {U})\) is even) \(\bar{\gamma }_{p_j(\mathcal {U})/2,\,j}(\mathcal {U})=0\). In particular, if \(p_j(\mathcal {U})\le 2\), then \(\bar{\gamma }_j(\mathcal {U})=0\).

Note that \(\dim \mathcal {U}\) can be replaced in these formulas by \(\dim \widetilde{\mathcal {U}}\) since they have the same parity.

4.2 The second leading coefficient of a subspace Ehrhart function

We saw in Proposition 3.1 that \(\alpha (\mathcal {U}^\kappa ;n)\) has no second leading term (the term of \(n^{2\kappa -\mathrm{codim }\mathcal {U}-1}\)) when \(\mathcal {U}\) is either a hyperplane \(\mathcal {H}^{d/c}_{ij}\) or a subhyperplane of the form \(\mathcal {W}^{\,d/c}_{ijk}\). This is a general phenomenon.

Theorem 4.2

For every subspace \(\mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P})\), the coefficient \(\bar{\gamma }_1(\mathcal {U})\) of the second leading term in \(\alpha (\mathcal {U};n)\) is zero.

Proof

We apply the theorem of McMullen [4, Theorem 6] that in the (open) Ehrhart quasipolynomial \(\gamma _0(\mathcal {P}) n^d + \gamma _1(\mathcal {P}) n^{d-1} + \cdots + \gamma _d(\mathcal {P})\) of a rational convex polytope \(\mathcal {P}\) of dimension \(d\), the coefficient \(\gamma _i(\mathcal {P})\) has period that is a divisor of a quantity \(\pi _i\) called the \(i\)-index of \(\mathcal {P}\), defined as the smallest positive integer \(\pi \) such that every \((d-i)\)-face of \(\mathcal {P}\) contains a rational point (it need not be in lowest terms) with denominator \(\pi \). (This is equivalent to the face’s affine span being generated by rational points with denominator \(\pi \), which is McMullen’s definition.) Thus, for instance, if every facet of \(\mathcal {P}\) spans an affine flat that contains an integral point, then the 1-index of \(\mathcal {P}\) is 1, i.e., \(\bar{\gamma }_1(\mathcal {P})\) is constant.

We apply McMullen’s theorem to \(\mathcal {P}= \mathcal {U}\cap [0,1]^{2q}\) where \(\mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P})\); that is, \(\mathcal {P}\) is the part of the subspace \(\mathcal {U}\) bounded by the inequalities \(x_i,y_i\ge 0\) and \(x_i,y_i\le 1\) for \(i\in [2q]\). A face of \(\mathcal {P}\) is the restriction of \(\mathcal {P}\) to some subset of boundary hyperplanes; i.e., we fix some set of \(x_i\)’s and \(y_i\)’s to be 0 and some other set to be 1.

The equations of \(\mathcal {U}\) have the form \(z_j-z_i \perp (d_r,-c_r)\) for some \(i<j\) and \((c_r,d_r)\in \mathbf {M}\). The equation means that \(z_j-z_i\) is parallel to \(m_r\). If \(\mathcal {U}\) satisfies \(z_j-z_i \parallel m_r\) for more than one basic move \(m_r\), then \(z_i=z_j\) so we can reduce \(q\) by identifying the \(i\)th and \(j\)th pieces; therefore, we may assume that no pair of pieces appears in more than one equation satisfied by \(\mathcal {U}\).

First, consider \(i=1\), which means we choose one \(x_i\) or \(y_i\) to be 0 or 1. Let that be \(x_1\). Define \(\Delta z := (z,z,\ldots ,z)\in \mathbb {R}^{2q}\). All such points with \(z\in [0,1]^2\) belong to \(\mathcal {P}\); therefore, in particular, each facet \(\mathcal {P}\cap \{x_1=k\}\) (where \(k=0\) or 1) contains the integral point \(\Delta (k,1)\). Consequently, the index \(\pi _1=1\). The Parity Theorem 4.1 implies then that \(\bar{\gamma }_1(\mathcal {U}) = 0\).\(\square \)

5 The form of coefficients on the square board

On the square board, it is possible to get fairly detailed information about the highest-order coefficients of the counting functions of nonattacking configurations.

First, we list the exact contributions to \(o_\mathbb {P}(q;n)\) of subspaces with low codimension. For \((c,d)\in \mathbf {M}\), let \({\hat{c}}=\min (|c|,|d|)\) and \({\hat{d}}=\min (|c|,|d|)\) and define \({\bar{n}}:=(n\, \mathrm{mod }\, {\hat{d}})\in \{0,1,\ldots ,{\hat{d}}-1\}\).

Lemma 5.1

The total contribution to \(o_\mathbb {P}(q;n)\) of the subspace of codimension \(0\) is \(n^{2q}\).

The total contribution of the subspaces of codimension \(1\) is \(-\left( {\begin{array}{c}q\\ 2\end{array}}\right) A_1(n)n^{2q-4}\) where

$$\begin{aligned} A_1(n) := \sum _{m\in \mathbf {M}} \alpha ^m(n) = a_{10}n^3 + a_{12} n + a_{13} \end{aligned}$$
(5.1)

with

$$\begin{aligned} a_{10}&= \sum _{(c,d)\in \mathbf {M}} \frac{3{\hat{d}}-{\hat{c}}}{3{\hat{d}}^2} , \\ a_{12}&= \sum _{(c,d)\in \mathbf {M}} \frac{ {\hat{c}}{\hat{d}}^2 + 3({\hat{d}}-{\hat{c}}) {\bar{n}}({\hat{d}}-{\bar{n}}) }{3{\hat{d}}^2} , \\ a_{13}&= - \sum _{(c,d)\in \mathbf {M}} \frac{{\hat{c}}}{3{\hat{d}}^2} {\bar{n}}({\hat{d}}-{\bar{n}})({\hat{d}}-2{\bar{n}}) . \end{aligned}$$

The period of \(A_1(n)\), as well as that of \(a_{12}\), is \(\Lambda :=\mathrm{lcm }\{{\hat{d}}_r: 1\le r \le |\mathbf {M}|\}\).

The appearance of \({\bar{n}}\) in \(a_{12}\) and \(a_{13}\) means that they depend on \(n\) through its residue class modulo \({\hat{d}}\), unlike \(a_{10}\), which is a constant.

Proof

The sign in \(-A_1(n)\) comes from the fact that the Möbius function \(\mu (\hat{0},\mathcal {H})=-1\) for a hyperplane \(\mathcal {H}\). The binomial coefficient counts the number of pairs \(\{i,j\}\). The evaluation of \(A_1\) comes from Proposition 3.1, and the periods come from its proof.\(\square \)

Theorem 5.1

(Square-Board Coefficient Theorem) On the square board, the coefficients \(\gamma _i\) for \(i\le 2\) are independent of \(n\). The coefficient \(q!\gamma _i\) of \(n^{2q-i}\) in \(o_\mathbb {P}(q;n)\) is a polynomial in \(q\), of degree \(2i\), which depends periodically on \(n\). The leading coefficients are

$$\begin{aligned} q!\gamma _0&= 1, \\ q!\gamma _1&= -(q)_2 \frac{a_{10}}{2} , \end{aligned}$$

and for \(i\ge 1\) the coefficients are

$$\begin{aligned} q!\gamma _i&=: (q)_{2i} \bar{\theta }_{i,2i} + (q)_{2i-1} \bar{\theta }_{i,2i-1} + \cdots + (q)_2 \bar{\theta }_{i,2} \nonumber \\&= \sum _{\kappa =2}^{2i} (q)_\kappa \sum _{\nu =\lceil \kappa /2\rceil }^{\min (i,2\kappa -2)} \sum _{[\mathcal {U}_\kappa ^\nu ]} \mu (\hat{0},\mathcal {U}_\kappa ^\nu ) \frac{1}{|\mathrm{Aut }(\mathcal {U}_\kappa ^\nu )|} \, \bar{\gamma }_{i-\nu }(\mathcal {U}_\kappa ^\nu ), \end{aligned}$$
(5.2)

in which \(\bar{\theta }_{i,2i}=(-{a_{10}}/{2})^i/i!\), the inner sum ranges over intersection subspace types \({[\mathcal {U}_\kappa ^\nu ]}\) such that \(\mathcal {U}_\kappa ^\nu \in \fancyscript{L}(\fancyscript{A}_\mathbb {P}^q)\), and

$$\begin{aligned} \bar{\theta }_{i,2} = {\left\{ \begin{array}{ll} -a_{10}/2 &{}\quad \mathrm { for }\,\, \textit{i}=1, \\ (|\mathbf {M}|-1)/2 &{}\quad \mathrm { for } \,\,\textit{i}=2, \\ -a_{12}/2 &{}\quad \mathrm { for }\,\, \textit{i}=3, \\ -a_{13}/2 &{}\quad \mathrm { for } \,\,\textit{i}=4, \\ 0 &{}\quad \mathrm { for }\,\, \textit{i}>4. \end{array}\right. } \end{aligned}$$

The period is a divisor of the least common multiple of the periods of all counting quasipolynomials \(\alpha (\mathcal {U};n)\) for \(\mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P}^q)\) such that \(\mathrm{codim }\mathcal {U}\le i\).

Proof

The polynomiality of \(q!\gamma _i\) is part of Theorem I.4.2, as is the constancy (with respect to \(n\)) of \(\gamma _0\) and \(\gamma _1\). The value of \(\gamma _2\) is determined by subspaces of codimension 2 or less. The contribution from codimension 2 is independent of \(n\) since it is the sum of leading coefficients. By Eq. (5.1), hyperplanes contribute zero. The contribution from \(\mathbb {R}^{2q}\) is zero. Thus, \(\gamma _2\) is independent of \(n\).

It remains to investigate the individual coefficients \(q!\gamma _i\) more closely. Because the auxiliary variable \(N\) now is simply \(n^2\), we recalculate the formula for \(o_\mathbb {P}(q;n)\) by rewriting Eq. (I.2.1), taking account of the simple form \(\alpha (\mathbb {R}^{2q};n)=n^{2q}\), substituting via Eq. (4.1), and simplifying as in the proof of Theorem I.4.2, to get

$$\begin{aligned} \begin{aligned} o_\mathbb {P}(q;n)&= n^{2q} + \sum _{\kappa =2}^{2i} (q)_\kappa \sum _{\nu =\lceil \kappa /2\rceil }^{\min (i,2\kappa -2)} \sum _{[\mathcal {U}_\kappa ^\nu ]} \mu (\hat{0},\mathcal {U}_\kappa ^\nu ) \frac{1}{|\mathrm{Aut }(\mathcal {U}_\kappa ^\nu )|} \sum _{j=0}^{2\kappa -\nu } \bar{\gamma }_j(\mathcal {U}_\kappa ^\nu ) n^{2q-\nu -j} , \end{aligned} \end{aligned}$$
(5.3)

summed over intersection subspace types \([\mathcal {U}_\kappa ^\nu ]\) such that \(\mathcal {U}_\kappa ^\nu \in \fancyscript{L}(\fancyscript{A}_\mathbb {P}^q)\). So, for \(i>0\) we have

$$\begin{aligned} q!\gamma _i = \sum _{\kappa =2}^{2i} (q)_\kappa \sum _{\nu =\lceil \kappa /2\rceil }^{\min (i,2\kappa -2)} \sum _{[\mathcal {U}_\kappa ^\nu ]} \mu (\hat{0},\mathcal {U}_\kappa ^\nu ) \frac{1}{|\mathrm{Aut }(\mathcal {U}_\kappa ^\nu )|} \bar{\gamma }_{i-\nu }(\mathcal {U}_\kappa ^\nu ). \end{aligned}$$

The next step is to determine the leading term and \(q!\gamma _1\). To do so, we study one isomorphism type of subspace:

Type \(\mathcal {U}_{2i}^i\): The subspaces \(\mathcal {U}_{2i}^i\) are those isomorphic to \(\mathcal {U}= \mathcal {H}_{12}^{l_1} \cap \cdots \cap \mathcal {H}_{2i-1,2i}^{l_i}\), where \(l_1,\ldots ,l_i\in \mathbf {M}\). The Möbius function is \(\prod _j \mu (\hat{0},\mathcal {H}_{2j-1,2j}^{l_j}) = (-1)^i\). The automorphisms depend on the selection of slopes. Write \(\mathbf {M}= \{m_1,m_2,\ldots ,m_s\}\) where \(s=|\mathbf {M}|\). Suppose \(k_r\) hyperplanes have slope \(m_r\). Then an automorphism of \(\mathcal {U}\) can reverse the subscripts in any pair, and it can permute the hyperplanes with the same slope. Thus, \(|\mathrm{Aut }(\mathcal {U})| = 2^i k_1! \cdots k_s!\). The value of \(\alpha (\mathcal {U};n)\) is \(\prod _{r=1}^s \alpha ^{m_r}(n)^{k_r}\), so the total contribution of all subspaces of type \(\mathcal {U}_{2i}^i\) is

$$\begin{aligned} \sum _{(k_1,\ldots ,k_s)} (-1)^i \frac{1}{2^i k_1! \cdots k_s!} \prod _{r=1}^s \alpha ^{m_r}(n)^{k_r}&= (-1)^i \frac{1}{2^i i!} \sum _{(k_1,\ldots ,k_s)} \frac{i!}{k_1! \cdots k_s!} \prod _{r=1}^s \alpha ^{m_r}(n)^{k_r} \\&= (-1)^i \frac{1}{2^i i!} A_1(n)^i, \end{aligned}$$

the sum being taken over all \(s\)-tuples \((k_1,\ldots ,k_s)\) of nonnegative integers whose total is \(s\). Since the leading coefficient of \(A_1(n)\) is \(a_{10}\), the coefficient of \((q)_{2i}\) in Eq. (5.2) is \(-a_{10}/2\). Since we assumed \(i>0\), that implies the complete formula for \(q!\gamma _1\).

The term of \((q)_2\) appears only when \(2 \ge i/2\), i.e., \(i\le 4\). The subspaces can be \(\mathcal {U}_2^1\), i.e., hyperplanes, and \(\mathcal {U}_2^2\), i.e., \(\mathcal {W}^{\,=}_{12}\) and its isomorphs. (\(\mathcal {W}^{\,=}_{12}\) is the subspace of configurations in which \(z_1=z_2\).)

Type \(\mathcal {U}_2^1\): Every hyperplane has \(\mu (\hat{0},\mathcal {U})=-1\) and \(|\!\mathrm{Aut }\mathcal {U}|=2\). Thus, the contribution of all hyperplanes is \(-A_1(n)/2\). Denoting (as before) the coefficient of \(n^{3-j}\) by \(a_{1j}\), the hyperplanes contribute \(-a_{1,i-1}/2\) to \(\bar{\theta }_{i2}\). That is zero when \(i=2\).

Type \(\mathcal {U}_2^2\): We have \(\mu (\hat{0},\mathcal {W}^{\,=}_{12})=|\mathbf {M}|-1\) and \(|\!\mathrm{Aut }\mathcal {W}^{\,=}_{12}|=2\). Since \(\alpha (\mathcal {W}^{\,=}_{12};n)=n^2\), the contribution of \([\mathcal {W}^{\,=}_{12}]\) to \(\bar{\theta }_{i2}\) is \((|\mathbf {M}|-1)\bar{\gamma }_{2-2}(\mathcal {W}^{\,=}_{12})/2 = (|\mathbf {M}|-1)/2\) when \(i=2\), and otherwise zero.\(\square \)

If we could obtain the coefficient \(\bar{\theta }_{i,2i-1}\) of \((q)_{2i-1}\), then we would have, in particular, the missing coefficient \(\bar{\theta }_{23}\) of a general formula for \(q!\gamma _2\). There is but one difficult step in that. Since \(\nu =i\),

$$\begin{aligned} \bar{\theta }_{i,2i-1} = \sum _{[\mathcal {U}]:\mathcal {U}=\mathcal {U}_{2i-1}^i} \mu (\hat{0},\mathcal {U}) \frac{1}{|\mathrm{Aut }(\mathcal {U})|} \, \bar{\gamma }_0(\mathcal {U}). \end{aligned}$$

The subspaces \(\mathcal {U}_{2i-1}^i\) have the form \(\big (\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2}\big ) \cap \mathcal {H}_{45}^{l_3} \cap \cdots \cap \mathcal {H}_{2i-2,2i-1}^{l_i}\), where \(l_1,\ldots ,l_i\in \mathbf {M}\). There are two types: \(l_1=l_2\) and \(l_1 \ne l_2\). The automorphism group has order \(H 2^{i-2}\) where \(H:=|\mathrm{Aut }\big (\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2}\big )|.\) The contribution of all subspaces of either type is

$$\begin{aligned} \frac{\mu (\hat{0},\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2})}{H 2^{i-2}}\alpha (\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2};n)\cdot (-1)^{i-2}A_1(n)^{i-2}, \end{aligned}$$

whose leading coefficient is

$$\begin{aligned} \frac{\mu (\hat{0},\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2})}{H} \big (-\frac{a_{10}}{2}\big )^{i-2}\bar{\gamma }_0(\mathcal {H}_{12}^{l_1} \cap \mathcal {H}_{23}^{l_2}). \end{aligned}$$

So we need the value of \(\bar{\gamma }_0(\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2})\) summed over all permitted slope pairs \((l_1,l_2)\).

Type \(\mathcal {U}_{2i-1\mathrm {a}}^i\): If \(l_1=l_2\), then \(\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2} = \mathcal {W}^{\,l_1}_{123},\) \(\mu (\hat{0},\mathcal {W}^{\,l_1}_{123})=2\), \(H=3!\), and \(\sum _{l_1}\bar{\gamma }_0(\mathcal {W}^{\,l_1}_{123}) = b_{10} := \sum _{(c,d)\in \mathbf {M}} (2{\hat{d}}-{\hat{c}})/2{\hat{d}}^3\) (from Proposition 3.1). The total contribution of this type to the coefficient is, therefore,

$$\begin{aligned} (-1)^i \frac{1}{3\cdot 2^{i-2}(i-2)!} \, a_{10}^{i-2} b_{10} . \end{aligned}$$

Type \(\mathcal {U}_{2i-1\mathrm {b}}^i\): When \(l_1 \ne l_2\), we have \(\mu (\hat{0},\mathcal {H}_{12}^{l_1}\cap \mathcal {H}_{23}^{l_2})=1\) and \(H=1\), but \(\alpha (\mathcal {H}_{12}^{l_1} \cap \mathcal {H}_{23}^{l_2};n)\) for arbitrary slopes \(l_1\) and \(l_2\) is too complicated for us. Finding just its leading coefficient would give \(\bar{\theta }_{i,2i-1}\).

6 One-move riders

Theorem 5.1 is best possible for pieces in general. Even for a piece with only one attacking move, the coefficient \(\gamma _3\) may vary with \(n\) with a large period. We prove that here (without appealing to the general theory). This leads us to propose that periodic variability of higher quasipolynomial coefficients occurs, not due to the number of attacking moves, but because of their slopes.

The intersection lattice \(\fancyscript{L}(\fancyscript{A}_\mathbb {P})\) of a one-move rider \(\mathbb {P}\) is the partition lattice \(\Pi _q\), so the Möbius function is known.

Consider a piece \(\mathbb {P}\) with move set \(\mathbf {M}=\{(c,d)\}\), where \(c\) and \(d\) are relatively prime integers such that \(0 \le c \le d\) and \(d>0\). Note that a move with \(c=0\) must have \(d=\pm 1\), by nontriviality (the zero move is not allowed) and relative primality.

Proposition 6.1

For a piece \(\mathbb {P}\) with move set \(\mathbf {M}= \{(c,d)\}\) where \(0 \le c \le d\),

$$\begin{aligned} u_\mathbb {P}(1;n)&= n^2,\\ u_\mathbb {P}(2;n)&= \frac{1}{2} \bigg \{ n^4 + \frac{c-3d}{3d^2} n^3 - \frac{c}{3} n\bigg \}\\&\quad +\frac{{\bar{n}}(d-{\bar{n}})}{6d^2}\bigg \{ [3(c-d)]n + c(d-2{\bar{n}}) \bigg \},\\ u_\mathbb {P}(3;n)&= \frac{1}{6} \bigg \{n^6 + \frac{c-3d}{d^2} n^5 - \frac{c-2d}{d^3} n^4 - c n^3 + \frac{c}{d} n^2 \bigg \}\\&\quad + \frac{{\bar{n}}(d-{\bar{n}})}{6d^3} \bigg \{ \big [ 3d(c-d) \big ] n^3 + \big [ 6d+cd^2-2cd{\bar{n}}-6c \big ] n^2\\&\qquad \qquad \qquad \ + \big [ 2(d-2 c)(d - 2{\bar{n}})\big ] n + 3c(d-{\bar{n}}){\bar{n}}\bigg \} ,\\ u_\mathbb {P}(4;n)&= \frac{1}{24} \bigg \{n^8 + \frac{2(c-3d)}{d^2} n^7 + \frac{c^2-18cd+33d^2}{3d^4} n^6 + \frac{18c-30d-10cd^4}{5d^4} n^5\\&\qquad \quad + \frac{18cd-2c^2}{3d^2} n^4 -\frac{4c}{d^2} n^3 + \frac{c^2}{3} n^2+\frac{2c}{5}n \bigg \}\\&\quad + \frac{{\bar{n}}(d-{\bar{n}})}{360d^4} \bigg \{ \big [90 d^2 (c - d) \big ] n^5 + \big [ 30 (c^2 + 15 d^2 -16c d + c d^3 - 2 c d^2 {\bar{n}}) \big ] n^4\\&\qquad \ + 10 \big [6 d (-9 + 2 d (d - 2 {\bar{n}})) + c^2 (d - 2 {\bar{n}}) + 27 c (2 - d^2 + 2 d {\bar{n}}) \big ] n^3\\&\qquad \ + 15 \big [ 2 d (-12 d + c (18 - c d + d^2)) + 3 (-24 c + (16 + c^2) d + 2 c d^2 + d^3) {\bar{n}}\\&\qquad \qquad \quad - 3 (c + d)^2 {\bar{n}}^2 \big ] n^2\\&\qquad \ + 10 \big [ 9 cd^2 - 9d^3-c^2 d^3 - (27 d^2 - 81cd + 5 c^2 d^2 - 3 cd^3) {\bar{n}}\\&\qquad \qquad \quad + 9 (3 d + c (cd - d^2-9)) {\bar{n}}^2 + 6 c ( d-c) {\bar{n}}^3 \big ] n\\&\qquad \ + c (d - 2 {\bar{n}}) \big [ d^2 (-6 + 5 c {\bar{n}}) - 3 d {\bar{n}}(36 + 5 c {\bar{n}}) + 2 {\bar{n}}^2 (54 + 5 c {\bar{n}}) \big ] \bigg \} . \end{aligned}$$

For \(q=2,3,4\), the period of \(u_\mathbb {P}(q;n)\) with respect to \(n\) is \(d\).

Proof

The formula for \(u_\mathbb {P}(1;n)\) is trivial. Theorem 3.1 implies the value of \(u_\mathbb {P}(2;n)\); a combinatorial count similar to that for \(u_\mathbb {P}(3;n)\) and \(u_\mathbb {P}(4;n)\) gives the same result.

Direct combinatorial arguments for \(q=3\) and \(4\) give

$$\begin{aligned} u_\mathbb {P}(3;n)&=\left( {\begin{array}{c}n^2\\ 3\end{array}}\right) - \sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 3\end{array}}\right) -\sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 2\end{array}}\right) \big [n^2-l\big ] \qquad \text {and} \\ u_\mathbb {P}(4;n)&= \left( {\begin{array}{c}n^2\\ 4\end{array}}\right) - \sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 4\end{array}}\right) -\sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 3\end{array}}\right) \big [n^2-l\big ]-\sum _{\{l,l'\}\subseteq \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 2\end{array}}\right) \left( {\begin{array}{c}l'\\ 2\end{array}}\right) \\&\quad \ -\sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 2\end{array}}\right) \bigg [\left( {\begin{array}{c}n^2-l\\ 2\end{array}}\right) -\sum _{l'\in \mathbf {L}(n)}\left( {\begin{array}{c}l'\\ 2\end{array}}\right) + \left( {\begin{array}{c}l\\ 2\end{array}}\right) \bigg ], \end{aligned}$$

where \(\mathbf {L}(n) := \mathbf {L}^{d/c}(n)\). For instance, \(u_\mathbb {P}(4;n)\) is the number of placements of four nonattacking pieces, which we count by placing four pieces on any of the \(n^2\) positions on the board and removing those where at least two pieces attack. We must remove the cases where four pieces are in the same line \(l^{d/c}(b)\), those where three pieces are in the same line and the fourth is in another line, those where two pieces are in the same line \(l^{d/c}(b)\) and the remaining two are both in another line \(l^{d/c}(b')\), and last, those where two pieces are attacking and the remaining two pieces attack none of the others.

The reasoning for \(u_\mathbb {P}(3;n)\) is simpler so we merely show the steps in the simplification:

$$\begin{aligned} u_\mathbb {P}(3;n)&= \left( {\begin{array}{c}n^2\\ 3\end{array}}\right) - \sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 3\end{array}}\right) -\sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 2\end{array}}\right) \big [n^2-l\big ]\\&= \left( {\begin{array}{c}n^2\\ 3\end{array}}\right) +2\sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 3\end{array}}\right) -(n^2-2)\sum _{l\in \mathbf {L}(n)} \left( {\begin{array}{c}l\\ 2\end{array}}\right) \\&= \left( {\begin{array}{c}n^2\\ 3\end{array}}\right) + 2 \bigg \{ 2cd \left( {\begin{array}{c}\frac{n-{\bar{n}}}{d}\\ 4\end{array}}\right) + \Big [ (d-{\bar{n}})\big (n-c\frac{n-{\bar{n}}}{d}\big )+c({\bar{n}}+d) \Big ] \left( {\begin{array}{c}\frac{n-{\bar{n}}}{d}\\ 3\end{array}}\right) \\&\qquad \qquad \qquad + \Big [ {\bar{n}}\big (n-c\frac{n-{\bar{n}}}{d}\big ) \Big ] \left( {\begin{array}{c}\frac{n-{\bar{n}}}{d}+1\\ 3\end{array}}\right) \bigg \}\\&\qquad - (n^2-2) \bigg \{ 2cd \left( {\begin{array}{c}\frac{n-{\bar{n}}}{d}\\ 3\end{array}}\right) + \Big [ (d-{\bar{n}})\big (n-c\frac{n-{\bar{n}}}{d}\big )+c({\bar{n}}+d) \Big ] \left( {\begin{array}{c}\frac{n-{\bar{n}}}{d}\\ 2\end{array}}\right) \\&\qquad \qquad \qquad \quad + \Big [ {\bar{n}}\big (n-c\frac{n-{\bar{n}}}{d}\big ) \Big ] \left( {\begin{array}{c}\frac{n-{\bar{n}}}{d}+1\\ 2\end{array}}\right) \bigg \} , \end{aligned}$$

which when expanded (we used Mathematica) gives the constant and periodic parts stated in the proposition. The simplification of \(u_\mathbb {P}(4;n)\) is similar.

The constant terms of the quasipolynomials for \(q=2,3,4\) have period \(d\) since they are zero only when \({\bar{n}}=0\). (Recall that \(c>0\).) The other coefficients have period dividing \(d\) since they depend on \(n\) through \({\bar{n}}\).\(\square \)

The equation for \(u_\mathbb {P}(3;n)\) agrees with the formulas for partial queens \(\mathbb {Q}^{10}\) and \(\mathbb {Q}^{01}\) in Part III. It would be instructive to find \(u_\mathbb {P}(q;n)\) in general, but this task seems difficult.

The example with \((c,d)=(1,2)\) simplifies nicely when \(q = 2, 3, 4\).

Corollary 6.1

For a piece \(\mathbb {P}\) with move set \(\mathbf {M}=\{(1,2)\}\), the following formulas hold:

$$\begin{aligned} u_\mathbb {P}(2;n)&= \left\{ \frac{n^4}{2}-\frac{5 n^3}{24}-\frac{11 n}{48}\right\} +(-1)^n\frac{n}{16},\\ u_\mathbb {P}(3;n)&= \left\{ \frac{n^6}{6}-\frac{5 n^5}{24}+\frac{n^4}{16}-\frac{11 n^3}{48}+\frac{7 n^2}{48}+\frac{1}{32}\right\} +(-1)^n\left\{ \frac{n^3}{16}-\frac{n^2}{16}-\frac{1}{32}\right\} ,\\ u_\mathbb {P}(4;n)&= \left\{ \frac{n^8}{24}-\frac{5 n^7}{48}+\frac{97 n^6}{1152}-\frac{131 n^5}{960}+\frac{223 n^4}{1152}-\frac{17 n^3}{192}+\frac{137 n^2}{2304}-\frac{73 n}{1920}\right\} \\&\quad \,+\,(-1)^n\left\{ \frac{n^5}{32}-\frac{29 n^4}{384}+\frac{3 n^3}{64}-\frac{35 n^2}{768}+\frac{7 n}{128}\right\} . \end{aligned}$$

In each formula of Proposition 6.1, the coefficient \(\gamma _3\) and the entire formula both have period \(d\). This suggests generalizations.

Proposition 6.2

For a one-move rider with basic move \((c,d)\) where \(0 \le c \le d\), the period of \(\gamma _3\) in \(u_\mathbb {P}(q;n)\) when \(q\ge 2\) is exactly \(d\). The periodic part is

$$\begin{aligned} -\frac{1}{(q-2)!} \frac{{\bar{n}}(d-{\bar{n}})(d-c)}{2d^2}. \end{aligned}$$

Proof

The subspaces that can contribute to \(q!\gamma _3\) are those of codimension at most 3. There is no contribution from codimension 0 since the open Ehrhart quasipolynomial is \(\alpha (\mathbb {R}^{2q};n)n^{2q}=n^{2q}\). The contribution from codimension 3 is constant.

The contribution from a hyperplane is the \(n^{2q-3}\) term of \(\mu (\hat{0},\mathcal {H}^{d/c}_{ij}) \alpha (\mathcal {H}^{d/c}_{ij}) n^{2q-4} = -\alpha ^{d/c}n^{2q-4}\). By Eq. (3.5), the periodic contribution is \(-{\bar{n}}(d-{\bar{n}})(d-c)/d^2\). There are \(\left( {\begin{array}{c}q\\ 2\end{array}}\right) \) hyperplanes.

There are two kinds of subspace of codimension 2.

Type \(\mathcal {U}^2_{4^*}\) :

This subspace is the intersection of two hyperplanes that involve disjoint pairs of pieces; i.e., \(\mathcal {U}^2_{4^*} = \mathcal {H}^{d/c}_{ij} \cap \mathcal {H}^{d/c}_{kl}\) where \(\{i,j\} \cap \{k,l\} = \varnothing \). The value of \(\alpha (\mathcal {U}^2_{4^*})\) is \((\alpha ^{d/c})^2\), whose \(n^5\) term, as one can see from Eq. (3.5), has coefficient 0. The contribution of this subspace to the \(n^{2q-3}\) term of \(o_\mathbb {P}(q;n)=q!u_\mathbb {P}(q;n)\) is the corresponding term in \(n^{2q-8}\alpha (\mathcal {U}^2_{4^*})\), so there is no contribution.

Type \(\mathcal {W}^{\,d/c}_{12}\) :

The contribution of each subspace is \(\beta ^{d/c}\). Each subspace contributes \(\mu (\hat{0},\mathcal {W}^{\,d/c}_{12}) \alpha (\mathcal {W}^{\,d/c}_{12}) n^{2q-6}\) to \(o_\mathbb {P}(q;n)\), in which the coefficient of \(n^{2q-3}\) is 0.

Thus, there is no contribution except from hyperplanes, whose total periodic contribution to \(q!\gamma _3\) is easily seen. Dividing by \(q!\) gives the periodic part of \(\gamma _3\).

To prove the period is \(d\), note that the periodic part vanishes if and only if \({\bar{n}}=0\) or \(c=d\). In the latter case, \(c=d=1\) so the period is \(d=1\).\(\square \)

Conjecture 6.1

For a one-move rider with basic move \((c,d)\), the period of \(u_\mathbb {P}(q;n)\) is exactly \(\max (|c|,|d|)\).

The period certainly is a multiple of \(\max (|c|,|d|)\) because of the period of \(\gamma _3\).

The number of combinatorial types is obviously \(1\) (as stated in Theorem I.5.8). This implies a check on any formula for \(u_\mathbb {P}(q;n)\), since \(u_\mathbb {P}(q;-1)\) must equal 1. Applying the check to \(u_\mathbb {P}(2;n)\), \(u_\mathbb {P}(3;n)\), and \(u_\mathbb {P}(4;n)\) in Proposition 6.1, realizing that \({\bar{n}}=d-1\) does give \(u_\mathbb {P}(q;-1)=1\) for \(q=2,3,4\).

7 A formula for the \(n\)-Queens Problem

Theorem 5.1 covers any number of pieces on any size board. By setting \(q=n\), we obtain what can be regarded as the first closed-form formula (according to [1]) for the \(n\)-Queens Problem, which is the case in which \(\mathbb {P}\) is the queen in the following result. Let \(\fancyscript{A}_\mathbb {P}^\infty \) be the arrangement in the countably infinite-dimensional vector space \(\mathbb {R}^\infty \) of all move hyperplanes \(\mathcal {H}^{d/c}_{ij}\), \(\{i,j\} \subset \mathbb {Z}_{>0}\).

Theorem 7.1

The number of ways to place \(n\) unlabeled copies of a rider piece \(\mathbb {P}\) on an \(n\times n\) board so that none attacks another is

$$\begin{aligned} u_\mathbb {P}(n;n)&= \frac{1}{n!} \sum _{i=1}^{2n} n^{2n-i} \sum _{\kappa =2}^{2i} (n)_\kappa \sum _{\nu =\lceil \kappa /2\rceil }^{\min (i,2\kappa -2)}\\&\sum _{[\mathcal {U}_\kappa ^\nu ]:\mathcal {U}_\kappa ^\nu \in \fancyscript{L}(\fancyscript{A}_\mathbb {P}^\infty )} \mu (\hat{0},\mathcal {U}_\kappa ^\nu ) \frac{1}{|\mathrm{Aut }(\mathcal {U}_\kappa ^\nu )|} \, \bar{\gamma }_{i-\nu }(\mathcal {U}_\kappa ^\nu ). \end{aligned}$$

This formula is very complicated and potentially infinite (potentially rather than actually, because for each value of \(n\), the number of nonzero terms is finite) but it is explicitly computable. We have not tried to compare its complexity with that of other methods of counting nonattacking placements.

8 Questions, extensions

Work on nonattacking chess placements raises many questions, several of which have general interest. Besides Conjecture 6.1 and others to appear in later parts, we propose the following directions for research.

8.1 Detailed improvements

These problems concern significant loose ends we left in basic counting questions.

  1. (a)

    Generalize Proposition 3.1 by finding a formula for the number of ways to place \(q\) mutually attacking pieces on the same slope line. The starting point is that the number of such placements in a line of length \(l\) is \(l^q\), which would be summed. A consequence by inclusion–exclusion will be a complete solution for one-move pieces, which in turn may suggest general results about periods.

  2. (b)

    Extend the formulas for \(u_\mathbb {P}(q;n)\) for \(q\le 4\) for a general one-move rider (Sect. 6) to larger numbers of pieces. This should give more indications of the behavior of periods.

  3. (c)

    Evaluate the coefficient of \((q)_3\) in \(q!\gamma _2\) for an arbitrary rider in Theorem 5.1 to get a complete formula for \(\gamma _2\).

  4. (d)

    It should be feasible to find an explicit formula for three pieces, similar to that for two pieces in Theorem 3.1. It would require a solution to Problem 8.1(a) for \(q=4\). There is one really new behavior: a subspace of codimension 3 may be given by three slope hyperplanes of different slopes on three pieces, that is, of type \(\mathcal {U}^3_3 = \mathcal {H}^{d/c}_{ij} \cap \mathcal {H}^{d'/c'}_{jk} \cap \mathcal {H}^{d''/c''}_{ik}\); finding \(\alpha (\mathcal {U})\) for \(\mathcal {U}^3_3\) looks harder than for the subspaces solved in Sect. 3. (Since \(\mathcal {U}^3_3\) does not exist for a 2-move rider, 2-move riders could be the first to work on.)

8.2 Recurrences and their lengths

Kotěšovec obtained empirical formulas for \(u_\mathbb {P}(q;n)\) for relatively large numbers \(q\) of various pieces (queen, bishop, nightrider, et al.) by computing the values for \(n=1,2,\ldots ,N\) where \(N\) is fairly large, and looking for a heuristic recurrence relation. He derives a generating function from that recurrence, and then uses the generating function to get a quasipolynomial formula. Since the recurrence is heuristic, the formula is unproved. To prove his formula, if the period is \(p\), he has to compute up to about \(N=2pq\), because the degree of the quasipolynomial being \(2q\), there are \(2pq\) undetermined coefficients (the leading coefficient being known). Worse, the period \(p\) is unknown. But if the recurrence is much shorter than \(p\), he will find a recurrence (without proof) from a much smaller value of \(N\). That seems always to be the case if \(p\) is large. In other words, there seems to be a recurrence for \(u_\mathbb {P}(q;n)\) that is much shorter than \(p\). Can our method explain this?

The length of the recurrence is the degree of the denominator of the generating function of \(u_\mathbb {P}(n)\) when it is reduced to lowest terms. The explanation of a (relatively) short recurrence is that the generating function, which has the standard form \(f(x)/(1-x^p)^{2q}\) where \(f(x)\) is a polynomial and \(p\) is the period, is not in lowest terms. Thus, there seems to be a systematic common factor of the numerator and denominator when expressed in standard form. (One instance is Kotěšovec’s conjecture about the denominator for \(q\) queens [3, 2nd ed., p. 14; 6th ed., p. 22].) Essentially nothing is known about the presumed common factor, starting with why it exists. This seems the most important research problem in the subject.

8.3 Period bounds

As we saw in Sect. 8.2 and will see throughout this series, periods and period bounds (which usually are denominators of inside-out polytopes) are essential information in obtaining formulas. However, the period of the whole quasipolynomial \(u_\mathbb {P}(q;n)\) is not the best indicator of the difficulty of computing \(u_\mathbb {P}(q;n)\). If we know the periods \(p_i\) of the coefficients \(\gamma _i\), the number of unknowns in interpolating the quasipolynomial from data becomes less than the number \(2pq\) mentioned in Sect. 8.2. Precisely stated, the number of undetermined coefficients in \(u_\mathbb {P}(q;n)\) (for fixed \(q\)), hence the number of values that are needed to determine all coefficients, is \(\sum _{i=1}^{2q} p_i\), which in known examples is much smaller than \(2pq\).

The difficulty is that it is a large task to compute the periods of all coefficients. Thus, we would like to have a simple “universal” bound on \(p_i\) that depends on \(q\), \(i\), and the set of moves, and is easy to compute. To that end, we offer a few conjectures of practical or theoretical interest.

8.3.1 Plausible bounds

For a piece \(\mathbb {P}\) with move set \(\mathbf {M}\), the move range \(\Vert \mathbb {P}\Vert \) is the maximum coordinate magnitude of a basic move, that is,

$$\begin{aligned} \Vert \mathbb {P}\Vert :=\max _{(c_r,d_r)\in \mathbf {M}} {\hat{d}}_r, \text { where } {\hat{d}}_r:=\max (|c_r|, |d_r|). \end{aligned}$$

For each positive integral distance \(\lambda \), there is a “largest” piece \(\mathbb {P}^{\max }_\lambda \) with move range \(\lambda \); its basic move set is \(\mathbf {M}_\lambda := \{ (c,d) : |c|, |d| \le \lambda ,\ \gcd (c,d)=1 \}\), which consists of every basic move consistent with having move range \(\lambda \). For instance, \(\mathbb {P}^{\max }_1\) is the queen and \(\mathbb {P}^{\max }_2\) the combined moves of the queen and the nightrider.

Conjecture 8.1

Among all pieces with \(\Vert \mathbb {P}\Vert \le \lambda \), \(\mathbb {P}^{\max }_\lambda \) maximizes the period of every coefficient \(\gamma _i\). (We assume here that \(q\) is fixed.)

Problem 8.1

Find the period of \(u_{\mathbb {P}^{\max }_\lambda }(q;n)\) and those of its coefficients. Or find reasonably close bounds.

These questions are surely hard and probably of theoretical interest only. In particular, Kotěšovec conjectures [3, sixth ed., p. 31] that the period of the queen, \(\mathbb {Q}=\mathbb {P}^{\max }_1\), is \(\mathrm{lcm }(1,2,\ldots ,F_q)\), \(F_q\) being the Fibonacci number. The period of the nightrider \(\mathbb {N}\), which has move range \(\Vert \mathbb {N}\Vert =2\), grows hugely with \(q\). It seems probable that for each \(\lambda \), the period of \(\mathbb {P}^{\max }_\lambda \) grows extremely rapidly with \(q\) (and also with \(\lambda \)), but if Kotěšovec is right, it may follow a discernible pattern. If so, that pattern may be of use.

8.3.2 Observed bounds

What we most want, though, is a simple formula in terms of, say, \(q\) and \(\Vert \mathbb {P}\Vert \) that gives an upper bound on the period \(p\), or better, which is guaranteed to have \(p\) as a divisor. We have no conjecture about this, but we propose a low bound on the periods of the highest nonconstant coefficients. Define

$$\begin{aligned} \Lambda :=\mathrm{lcm }\{{\hat{d}}_r : m_r \in \mathbf {M}\}. \end{aligned}$$

Conjecture 8.2

The period of \(\gamma _3\) is \(1\) or \(\Lambda \). (We see period \(\Lambda \) for two pieces—see Theorem 3.1; for any number of one-move riders—see Proposition 6.2; for three partial queens—see Part III; and for two partial nightriders—see Sect. IV.6.)

Conjecture 8.3

The period of \(\gamma _4\) divides \(\Lambda \).

A second kind of maximal piece, suggested by Conjectures 8.2 and 8.3, is \(\mathbb {P}^{\mathrm{lcm }}_\lambda \), whose move set consists of all moves \((c,d)\) such that \({\hat{d}}|\lambda \). It might be called “lcm-maximal.” Conceivably, it may be more natural than \(\mathbb {P}^{\max }_\lambda \) for bounding periods.

Conjecture 8.4

Among all pieces with \(\mathrm{lcm }\{{\hat{d}}_r : m_r \in \mathbf {M}\}=\lambda \), \(\mathbb {P}^{\mathrm{lcm }}_\lambda \) maximizes the period of every coefficient \(\gamma _i\). (We assume here that \(q\) is fixed.)

Problem 8.2

Find the period of \(u_{\mathbb {P}^{\mathrm{lcm }}_\lambda }(q;n)\) and those of its coefficients. Or find reasonably close bounds.

8.3.3 The geometry of coefficient periods

Despite the hopes expressed in the preceding conjectures, the most effective way to bound periods may be to find subspace denominators by geometrical computation. Geometry also suggests a general monotonicity property.

We see in formulas here and in Parts III (Theorem III.3.1) and IV and in Kotěšovec’s book [3] that the period \(p_i\) of \(\gamma _i\) tends to increase with \(i\). The geometry suggests that should be a general truth. Let \(\fancyscript{L}_0^i = \{ \mathcal {U}\in \fancyscript{L}(\fancyscript{A}_\mathbb {P}) : \mathrm{codim }\mathcal {U}\le i\}\). Each \(\gamma _i\) depends on the subspaces in \(\fancyscript{L}_0^i\). Define the denominator \(D_i^q\) of the system \((\mathcal {B}^q,\fancyscript{L}_0^i)\) to be the least common denominator of coordinates of all points determined by intersecting a subspace \(\mathcal {U}\in \fancyscript{L}_0^i\) with the boundary of \([0,1]^{2q}\). Every point so determined for \(i\) is also so determined for \(i+1\), since \(\fancyscript{L}_0^i \subseteq \fancyscript{L}_0^{i+1}.\) It follows that each \(D_{i+1}^q\) is a multiple of \(D_i^q\). By Ehrhart theory, \(p_i\) divides \(D_i^q\); we expect \(p_i\) to increase weakly with \(i\).

Conjecture 8.5

The periods \(p_i\) of \(u_\mathbb {P}(q;n)\) are weakly monotonically increasing: \(1 = p_0 = p_1 \le \cdots \le p_{2q}\). (If so, then the whole period \(p=p_{2q}\).) More precisely, \(p_i\) divides \(p_{i+1}\).

And here is a final, stronger conjecture. In Ehrhart theory, in general the period need not equal the denominator, but in our formulas we always find equality.

Conjecture 8.6

The period \(p\) of \(u_\mathbb {P}(q;n)\) equals the denominator \(D([0,1]^{2q},\fancyscript{A}_\mathbb {P})\). The period \(p_i\) of \(\gamma _i\) in \(u_\mathbb {P}(q;n)\) equals \(D_i^q\).