Queens: Combinatorics and Algorithmics
- Queens are a family of chessboard placement problems defined by the non-attacking queen relation across rows, columns, and diagonals.
- They encompass classical and toroidal variants, utilizing permutation encodings and hypergraph formulations to analyze feasibility and count solutions.
- Applications extend to asymptotic enumeration, optimization algorithms, and spectral graph theory, providing insights into combinatorial and probabilistic methods.
Queens, in combinatorics and algorithmics, denotes a family of chessboard placement problems defined by the queen attack relation—common row, common column, or common diagonal. The central object is the -queens problem: place mutually non-attacking queens on an board, or count how many such placements exist. The same attack primitive also underlies toroidal, reflecting, Toeplitz, infinite-board, higher-dimensional, completion, coverage, and peaceability variants, together with graph-theoretic, probabilistic, spectral, and optimization formulations (Bowtell et al., 2021, Clinch et al., 2024, Dai et al., 2024).
1. Classical and toroidal formulations
On the classical board, a queen at attacks any square with , , , or . A partial configuration is a set 0 with at most one queen in each row, column, and non-toroidal diagonal; an 1-queens configuration is a partial configuration of size 2 (Luria et al., 2021).
A standard encoding uses a permutation 3, where row 4 contains a queen in column 5. The row and column constraints are then automatic, and the remaining obstruction is diagonal collision. Formally, a classical solution is a 6 for which all values 7 and 8 are distinct. This permutation viewpoint is central both to asymptotic counting and to probabilistic algorithms (Bowtell et al., 2021).
The toroidal variant replaces the board by a torus: rows and columns are indexed modulo 9, and both diagonal families wrap around modulo 0. There are exactly 1 toroidal diagonals of each type, all of size 2. A toroidal configuration is therefore a permutation 3 such that the residues 4 are all distinct and the residues 5 are all distinct (Luria et al., 2021).
This modular structure admits a hypergraph formulation. A toroidal configuration is exactly a perfect matching in a natural 6-partite, 7-uniform hypergraph 8 with parts 9, each of size 0, whose edges are quadruples 1. The classical problem similarly corresponds to matchings in a related non-regular hypergraph 2 with non-wrapping diagonal parts of size 3 (Bowtell et al., 2021).
2. Existence theorems and early milestones
The classical existence theory is elementary only at a coarse level. The values 4 are trivial, and classical solutions exist for all 5. Historically, 6 was found by Nauck in 1850 and proved by Glaisher and Pauls in 1874; values of 7 are tabulated up to 8 in OEIS A000170 (Bowtell et al., 2021).
The toroidal existence criterion is much sharper. Pólya proved in 1918 that
9
Thus toroidal feasibility is governed by a complete congruence obstruction, unlike the classical board (Bowtell et al., 2021).
Several other queen models exhibit distinct arithmetic thresholds. On a symmetric 0 Toeplitz matrix 1, where queens attack by row, column, or equal Toeplitz value 2, 3 nonattacking queens can be placed if and only if 4. In the same model, 5 nonattacking queens can be placed for every 6 (Szaniszlo et al., 2010).
Reflecting queens provide another existence theory. On an 7 board with a 8 reflecting strip attached along one side, diagonal paths may reflect via the strip. Klarner’s reflecting 9-queens problem is equivalent to Slater’s number-theoretic pairing problem, and reflecting 0-queens configurations exist for all sufficiently large 1. Small nonexistence is known for 2; existence was constructed for 3, and computationally for 4 (Dai et al., 2024).
3. Asymptotic enumeration
The modern counting theory separates the classical count 5 from the toroidal count 6. Rivin, Vardi, and Zimmerman conjectured that
7
on the Pólya residue classes for the toroidal problem. Luria proved the first general asymptotic upper bounds: 8 with 9, and conjectured that the toroidal upper bound is tight when 0 (Luria, 2017).
Bowtell and Keevash proved that conjecture. For the toroidal problem,
1
and 2 otherwise. They also proved
3
for all sufficiently large 4. Their proof combines a random greedy algorithm with randomized algebraic construction and iterative absorption, phrased in the language of hypergraph matchings (Bowtell et al., 2021).
For the classical problem, the constant 5 is not the final answer. Simkin proved that there exists a constant 6 with 7 and 8 such that
9
The proof introduces limit objects called queenons, defines a strictly concave entropy functional 0 on the compact convex set of queenons, and identifies 1 by the variational principle 2 (Simkin, 2021).
The toroidal constant 3 admits a heuristic interpretation. Starting from 4 permutations, the two diagonal families are approximately collision-free with probability about 5 each, and a further joint constraint contributes a third 6 factor, suggesting 7. Bowtell–Keevash formalize the lower bound, while Luria’s entropy argument formalizes the matching upper bound (Bowtell et al., 2021).
4. Completion, construction, and computation
The 8-queens completion problem asks whether a given partial non-attacking configuration can be extended to a full 9-queens configuration. Let 0 be the largest 1 such that every placement of 2 mutually non-attacking queens is completable. Glock, Munhá Correia, and Sudakov proved that, for all sufficiently large 3,
4
The lower bound uses rainbow matchings in bipartite graphs, probabilistic sparsification, and a generalized rainbow matching lemma; the upper bound comes from explicit non-completable partial configurations and a linear-programming dual line-weighting certificate (Glock et al., 2021).
That upper bound was improved in 2026. For all sufficiently large 5,
6
The improvement preserves the line-weighting method but refines the covering construction for the unattacked squares of a carefully chosen partial configuration (Nielsen, 23 Jun 2026).
For direct construction of full configurations, a simple two-stage randomized algorithm gives a strong lower bound for the classical counting problem. Stage 1 runs a toroidal random greedy process up to
7
and with high probability places 8 queens while maintaining dynamic concentration
9
for 0. Stage 2 uses absorbers to convert the partial toroidal configuration into a full classical one, yielding
1
Optimization-oriented computation has produced different objective variants. Integer programming models with row, column, and diagonal constraints were used to compute many new lexicographically optimal solutions for 2, and a lexicographic bottleneck “most beautiful” variant was solved up to 3 (Fischetti et al., 2019). A separate Monte Carlo line of work reformulates counting as a rare-event problem, uses quantile re-ordering based on the Lorenz curve, and combines vertical-likelihood Monte Carlo, importance sampling, simulated annealing, nested sampling, and a Swendsen–Wang style algorithm for sampling binary matrices (Polson et al., 2024).
5. Structural abstractions
Several structural formalisms organize the queens literature beyond direct board combinatorics. For fixed 4 identical queens on a dilated rational convex polygon 5, inside-out Ehrhart theory implies that the number 6 of nonattacking placements is a quasipolynomial in 7 of degree 8. Its leading coefficient is 9, and reciprocity identifies 00 with the number of unlabelled combinatorial configuration types. The exact formula is indexed by the intersection semilattice of attack hyperplanes and a slope matroid of weighted graphs (Chaiken et al., 2013).
The asymptotic theory of the classical problem introduces queenons, which are probability measures on 01 with uniform marginals and sub-uniform diagonal marginals. They extend permutons by encoding diagonal sparsity. The count of configurations approximating a fixed queenon is controlled by an entropy functional involving Kullback–Leibler divergence of the measure itself and of its diagonal pushforwards, and a large deviations principle shows that typical large 02-queens configurations concentrate near the unique entropy maximizer (Simkin, 2021).
A distinct structural notation appears in graph theory: the 03-Queens’ graph 04 has the 05 board’s squares as vertices, with two vertices adjacent when the corresponding squares share a row, a column, or a diagonal. This graph decomposes as the sum of block-structured matrices coming from two triangular queen graphs 06 and 07, a disjoint union of cliques along anti-diagonals, and two disjoint unions of complete bipartite graphs 08. The triangular graphs are regular and integral, with explicitly determined spectra, and Weyl’s inequalities then give eigenvalue bounds for the full attack graph (Cardoso et al., 1 Aug 2025).
These abstractions are complementary. Hypergraphs encode feasibility and counting on toroidal and classical boards; inside-out polytopes control exact quasipolynomiality for fixed 09; queenons govern the classical asymptotic constant; and attack graphs expose spectral structure on the square-board geometry.
6. Variants, extensions, and asymptotic regimes
The peaceable queens problem replaces mutual non-attack by bipartite non-attack: maximize 10 such that one can place 11 white queens and 12 black queens on an 13 board with no opposite-color capture. For the regular board, 14 for all sufficiently large 15, improving the previous 16 bound. On the torus, parity causes a sharp odd–even split: 17 with asymptotic lower bounds 18 for even 19 and 20 for odd 21 (Clinch et al., 2024).
Higher-dimensional random-placement models replace exact non-attack by the expected proportion of safe squares. For 22 random queens on an 23 board, that proportion converges to
24
The same framework defines line-queens and hyper-queens on 25-dimensional boards, with rook-like contributions 26 and additional bishop-like factors; in dimension 27, the line-queen safe-square proportion converges to
28
Infinite-board greedy placement leads to another asymptotic geometry. On the doubly infinite board 29 numbered along a square spiral, the greedy non-attacking queens are described by the Tribonacci word; the placements lie on four lines of slopes 30 and 31, where 32 is the Tribonacci constant. On the single-quadrant board 33 numbered along antidiagonals, rows and columns of the associated Sprague–Grundy table are permutations of 34, and the queen positions are conjectured to lie on two lines of slopes 35 and 36 (Dekking et al., 2019).
A fixed-37 coverage variant asks, not for non-attack, but for the maximum number of covered squares. For each fixed 38, there is a non-attacking threshold beyond which all optimal configurations are pairwise non-attacking, and a stabilizing threshold beyond which the set of optimal configurations becomes constant. Using the resulting loss-function analysis, all optimal large-board configurations were determined for 39 (Adhikari et al., 4 Aug 2025).
Taken together, these variants show that queens problems are not a single counting puzzle but a broad research domain. Their shared attack geometry supports arithmetic existence theorems, entropy maximization, quasipolynomial counting, rainbow matching methods, spectral decomposition, probabilistic asymptotics, and a growing catalogue of board-dependent threshold phenomena.