# One pattern lets black and white queens each cover more than one twelfth of any odd wraparound board of side 33 or larger

How many black and white queens can fit on a chessboard if no black queen may share a row, column or diagonal with a white queen? On a wraparound board, a line that leaves one edge continues from the opposite edge. For boards with an odd number of squares per side, a known pattern lets each colour occupy a fraction approaching one twelfth of the board. Computer searches found denser placements at particular sizes. [Repeating a placement](https://github.com/jphme/math-problems/blob/main/peaceable-queens-even-torus/peace_even_torus.pdf) preserves its density when the new side length is a multiple of the old one, but leaves open what happens at other sizes, including primes.

One rule beats one twelfth on every odd board of side 33 or larger. The rule gives the two colours exactly equal numbers of queens. As the side length $n$ grows, each colour's share approaches 8.746%, up from 8.333% for the earlier pattern. Even on a finite board, each colour gets more than $(1719/19654)n^2-12$ queens. Combining the rule with known smaller placements shows that every odd side length from 13 onward admits a placement above one twelfth per colour.

## Colouring the lines of the board

[Clinch, Drescher, Huynh and Saffidine](https://arxiv.org/html/2406.06974v3) called their general pattern for odd boards *argyle*. It gives at least $n^2/12-O(n)$ queens per colour: the shortfall from one twelfth of the squares is at most proportional to the side length. Their search also found 348 queens of each colour on a board of side 63. The difficulty in extending such a placement is at the edge. On a board of side $63k$, where $k$ is a positive integer, a repeating pattern of side 63 lines up with itself along rows, columns and both diagonals. On a board of side $63k+1$, a diagonal crossing the edge arrives one line off.

Instead of repeating squares, we give each line a colour. Number the rows and columns starting at zero. The square in row $x$ and column $y$ lies on four lines labelled $x$, $y$, $x+y$ and $x-y$, respectively. Read each label modulo $n$, so that labels differing by $n$ denote the same line in that direction. In a placement without attacks between colours, all queens on any occupied line have the same colour. Conversely, once the lines have colours, we can fill every square where all four lines agree. To use the same rule at different sizes, mark the labels $k$ for each direction at positions $k/n$ on a circle of circumference one. Give whole intervals of the circle a colour. Each board then samples the same intervals at its own spacing, and no line serves both colours.

We tested interval colouring on all 26 published odd boards of side 13 through 63. We read queen positions from the centres of squares in the [original figures](https://arxiv.org/abs/2406.06974v1) and the [revised figures](https://arxiv.org/html/2406.06974v3#A1), then checked which lines the queens occupied. On the side-35 image we removed two black sites on one diagonal shared by both colours.

For each board we widened each label into a centred interval of width $1/n$. Before widening, we tested two choices of coordinates: the original $(x,y)$ and the diagonal coordinates $(x+y,x-y)$. In each we multiplied both coordinates by the same number, trying every multiplier invertible modulo $n$ (one that permutes the labels), up to a change of sign. We tried assigning the unused lines to black, to white or to neither.

We scored a trial by the fraction of the continuous board available to the smaller army. Consider a square of side $1/n$ centred on a grid point. Throughout that square the row and column colours stay fixed. In its central diamond, which covers half the square, both diagonal labels also stay fixed. In each of the four corner triangles, one diagonal label shifts by one. Each triangle contributes an eighth of the square's area if its colours agree. Only 39 of 2,388 trials exceeded $1/12$, all from sides 55, 59, 61 and 63.

Moving the interval boundaries increased the area. A symmetric fit to the side-55 board gave exactly $600/6889$ (8.710%) per colour. For the side-63 board, the fitted boundaries for rows and columns fell close to twentieths of the circle. Using those twentieths and identical colour bands for both diagonal directions gave about 8.733% per colour, with slightly unequal areas. A denser pattern uses opposite colours for corresponding rows and columns, and likewise for the two diagonal directions. This choice balances the armies even on a finite grid.

## The placement rule

Two lists of distances specify the colours. For any position $t$ on the circle, use its distance $u(t)$ to the nearest integer, so that positions just below and just above zero are treated alike. Let $R(t)$ give the row colour and $S(t)$ the colour for a sum diagonal, with 1 for black and 0 for white. Both start at 1 at distance zero. As the distance increases toward $1/2$, switch colour at each distance in the corresponding list, using the new colour at the switch itself:
$$
\begin{aligned}
R:&\quad (1,2,5,8,9)/20,\\
S:&\quad (731,2512,3194,3707,4867)/9827.
\end{aligned}
$$
Columns take the opposite of the row colour at the same position; difference diagonals take the opposite of the sum-diagonal colour. The four colours at square $(x,y)$ are therefore
$$
R(x/n),\qquad 1-R(y/n),\qquad S((x+y)/n),\qquad 1-S((x-y)/n).
$$
Place a black queen if all four are 1 and a white queen if all four are 0. Otherwise leave the square empty. A quarter-turn about the origin sends $(x,y)$ to $(-y,x)$: rows exchange with columns and sum diagonals with difference diagonals, up to sign. Since the colours depend only on distance, the sign changes have no effect. The turn thus pairs each black square with a white one. Write $N(n)$ for the resulting number of queens of each colour.

![Queen placements on wraparound boards of sides 63 and 179. Dark and white squares hold queens; grey squares are empty.](results/quarter-turn.png)

*Figure 1. The same rule gives 348 queens per colour at side 63 and 2,802 at the unrelated prime side 179. A quarter-turn about the coordinate origin exchanges dark and white, wrapping at the edges.*

At three of the four sizes that exceeded one twelfth in the interval trials, the rule matches the published number of queens per colour (Table 1). The counts can match even if the placements differ.

*Table 1. Queens per colour at the four sizes that yielded dense interval patterns. For published placements with unequal armies, the smaller count is the number both armies can retain.*

| Side | Published placement, smaller army | Fixed rule, each army |
|---:|---:|---:|
| 55 | 264 | 262 |
| 59 | 304 | 304 |
| 61 | 324 | 324 |
| 63 | 348 | 348 |

## The area available to each colour

On a continuous unit square with opposite edges identified, the black region has area exactly $p=1719/19654$. To calculate it, group points by their row and column distances $a,b\in(0,1/2)$. If $R(a)=1$ and $R(b)=0$, all four points $(\pm a,\pm b)$ have a black row and column. Changing one sign exchanges the distances of the sum and difference diagonals. When $S(a+b)$ and $S(a-b)$ differ, exactly two of the four points have both diagonals black. When the values agree, none do.

We used this test to choose the switching distances. We divided the distance interval into equal steps, trying 58 different spacings. For each spacing we scored colour assignments by counting pairs that passed both the row-and-column test and the diagonal test. We changed the colour of a single interval whenever that improved the score, using 64 starts and eight rounds of perturbation per start. We then allowed the boundaries to move between grid points. With the row and column boundaries fixed at twentieths, the area is locally a quadratic function of the five diagonal switching distances. Each polygon vertex moves linearly with the boundaries until a different pair of edges meets. Setting the five first derivatives to zero and solving the resulting linear equations gave the diagonal distances listed above.

As a separate check, we split each switching line wherever another colour changed and measured the lengths available to black along it. At each row-and-column switch, the length gained along one direction matched the length lost along the other. At $1/20$, for example, both lengths are $2483/19654$. The diagonal lengths also matched when measured along the $x$ coordinate. These cancellations mean that small rounding shifts in the boundaries have no first-order cost in area.

For the exact area, pair each of the three intervals where $R(a)=1$ with each of the three where $R(b)=0$. Within each resulting rectangle, keep the bands where the diagonal values differ. If the sum $a+b$ lies in $[s,S_1]$, the difference $a-b$ in $[d,D]$ and the rectangle's vertical range is $Y$, the allowed values of $b$ at a given $a$ form the interval $Y\cap[s-a,S_1-a]\cap[a-D,a-d]$. Its length varies linearly between crossings of the endpoint lines, so summing trapezoid areas between successive crossings gives the exact area. Let $Q=\operatorname{lcm}(20,9827)=196540$ be the least common multiple of the two boundary denominators. The nine contributions, with rows and columns in increasing distance order and with the factor of two for signs included, are
$$
\frac1{Q^2}
\begin{pmatrix}
144825853&350297657&33961740\\
421064043&1366607756&350297657\\
145577998&421064043&144825853
\end{pmatrix}.
$$
They sum to $p$. Integrating the black and white regions separately over the full square also gives $p$ for each. This area determines the limiting share on discrete boards: only grid squares touching a colour boundary can contribute to the difference between $N(n)$ and $pn^2$. There are finitely many straight boundaries, so the number of such squares grows only as $O(n)$.

## Exact counts on odd boards

In fact the shortfall from $pn^2$ is less than twelve queens per army at every odd side length. We can check infinitely many sizes with finitely many counts because the rounding error has a predictable form. Draw the colour boundaries in the unit square, including the lower edge in each coordinate and excluding the upper edge to avoid counting a wraparound point twice. All line intercepts are multiples of $1/Q$. The determinant formed by the normal vectors of two intersecting lines has absolute value 1 or 2, so solving the two line equations puts each vertex on the grid of spacing $1/(2Q)$.

[Ehrhart's lattice-point theorem](https://arxiv.org/abs/0904.0679) describes how many points of the grid of spacing $1/n$ lie in a closed polygon with such vertices. Among side lengths $n$ with the same remainder on division by $2Q=393080$, the count is a polynomial in $n$ of degree at most two. Its quadratic coefficient is the polygon's area. To apply the theorem with our rule for ties, count polygon interiors, edge interiors and vertices separately, keeping those assigned to black. Each interior count comes from the closed piece by subtracting its boundary. Edges and vertices contribute terms of at most first degree.

Thus for each remainder, $N(n)-pn^2$ is at most linear in $n$. If two sizes with the same remainder give the same error, the error must be constant for that remainder. For each of the 196,540 odd remainders $r$ between 1 and 393079, we counted queens at $r$ and $r+393080$. The errors agreed in every pair. Over all odd $n$ the exact range is
$$
-\frac{7553}{634}\ \le\ N(n)-pn^2\ \le\ \frac{1995}{634}.
$$
The endpoints occur at sides 21,669 and 64,883, respectively.

To make each count, we applied the same sign test as for the area, using integer row and column distances $i,j$ from 1 to $(n-1)/2$. A distance of zero cannot contribute, since the sum and difference distances would agree. Using the rule for ties, we split each range of $i,j,i+j,i-j$ into inclusive integer intervals of constant colour. We then counted pairs in the intersections without scanning boards hundreds of thousands of squares wide.

The building block for this count is $F(u,v)$, the number of nonnegative integer pairs $(i,j)$ with $i+j\le u$ and $i-j\le v$. Let $H(w)$ count pairs with $i\ge j\ge0$ and $i+j\le w$. This is $H(w)=\lfloor(w+2)^2/4\rfloor$ for $w\ge0$ and zero otherwise. Then $F=0$ for $u<0$, and otherwise
$$
 F(u,v)=
 \begin{cases}
 H(u+v), & v<0,\\
 (u+1)(u+2)/2-H(u-v-1), & v\ge0.
 \end{cases}
$$
For $v<0$, shift $j$ down by $-v$ and exchange the coordinates. For $v\ge0$, count all pairs satisfying the sum bound and subtract the excluded pairs, shifting $i$ down by $v+1$ to count them. To impose the row and column intervals, translate the origin to their lower endpoints. Subtract the counts starting one past each upper endpoint and add back the overlap. For each diagonal interval, take the difference between the count at its upper bound and the count one below its lower bound. This gives the number of pairs in each bounded piece. A separate row-by-row count recovered both error extrema. Direct inspection of every square at 81 side lengths through 1,009 confirmed both army sizes and the absence of shared attack lines in all four directions.

## Where the gain begins

The last odd side at which the rule fails to exceed $n^2/12$ is 31. Exact counts establish this through side 399. For $n\ge401$, the gain $(p-1/12)n^2$ exceeds 12 and so covers the largest possible shortfall. The same test against $304/59^2$, the highest published density among sides 55, 59 and 61, gives a last miss at 175.

Smaller published placements let us locate the threshold for the puzzle itself. Between 13 and 31, the rule misses at 13, 15, 19, 25, 27, 29 and 31. The published boards at those sizes supply 16, 20, 32, 56, 66, 76 and 88 queens per colour, respectively, all above $n^2/12$. At side 11 the maximum is ten per colour ([Online Encyclopedia of Integer Sequences, entry A279405](https://oeis.org/A279405)), one short of the eleven required. To check that exclusion, we enumerated the sets of row and column colours, treating translations and exchanges of the axes as equivalent. For each choice we enumerated all sets of sum-diagonal colours. Each remaining diagonal could supply black sites or white sites. For each target of up to eleven black sites, we kept the smallest number of white sites that had to be given up. No choice allowed eleven sites of both colours.

Every odd side from 13 onward therefore admits two equal armies above one twelfth. Some of the gain on individual boards persists even at unrelated prime sizes, though the side-63 share $348/63^2$ exceeds the rule's limiting share. The largest fraction attainable on all large odd boards remains open.
