Queens Problem

DOWNLOAD Mathematica Notebook QueensMax

What is the maximum number of queens that can be placed on an n×n chessboard such that no two attack one another? The answer is n-1 queens for n=2 or n=3 and n queens otherwise, which gives eight queens for the usual 8×8 board (Madachy 1979; Steinhaus 1999, p. 29). The number of different ways the n queens can be placed on an n×n chessboard so that no two queens may attack each other for the first few n are 1, 0, 0, 2, 10, 4, 40, 92, ... (OEIS A000170; Madachy 1979; Steinhaus 1999, p. 29). The number of rotationally and reflectively distinct solutions of these are 1, 0, 0, 1, 2, 1, 6, 12, 46, 92, ... (OEIS A002562; Dudeney 1970; p. 96). The 12 distinct solutions for n=8 are illustrated above, and the remaining 80 are generated by rotation and reflection (Madachy 1979, Steinhaus 1999).

QueensMin

The minimum number of queens needed to occupy or attack all squares of an n×n chessboard (i.e., domination numbers for the n×n queen graphs) are given for n=1, 2, ... by 1, 1, 1, 2, 3, 3, 4, 5, 5, 5, 5, 6, 7, 8, 9, 9, 9, 9, 10, ... (OEIS A075458), where Steinhaus 1999 (p. 29) notes gamma(Q_(8,8))=5.

Dudeney (1970, pp. 95-96) gave the following results for the number of distinct arrangements N_p(k,n) of k queens attacking or occupying every square of an n×n board for which every queen is attacked ("protected") by at least one other, with the n=8 value given by Steinhaus (1999, p. 29). The 4860 solutions in the n=5 case may be obtained from 638 fundamental arrangements by rotation and reflection.

k queensn×nN_p(k,n)
243
3537
361
475
584860

Dudeney (1970, pp. 95-96) also gave the following results for the number of distinct arrangements N_u(k,n) of k queens attacking or occupying every square of an n×n board for which no two queens attack one another (they are "not protected").

k queensn×nN_u(k,n)
121
131
342
352
4617
471
5891

Vardi (1991) generalizes the problem from a square chessboard to one with the topology of the torus. The number of solutions for n queens with n odd are 1, 0, 10, 28, 0, 88, ... (OEIS A007705). Vardi (1991) also considers the toroidal "semiqueens" problem, in which a semiqueen can move like a rook or bishop, but only on positive broken diagonals. The number of solutions to this problem for n queens with n odd are 1, 3, 15, 133, 2025, 37851, ... (OEIS A006717), and 0 for even n.

Velucchi gives the solution to the question, "How many different arrangements of k queens are possible on an order n chessboard?" as 1/8th of the coefficient of a^kb^(n^2-k) in the polynomial

 p(a,b,n)={(a+b)^(n^2)+2(a+b)^n(a^2+b^2)^((n^2-n)/2);   +3(a^2+b^2)^(n^2/2)+2(a^4+b^4)^(n^2/4);  n even; (a+b)^(n^2)+2(a+b)(a^4+b^4)^((n^2-1)/4);   +(a+b)(a^2+b^2)^((n^2-1)/2);   +4(a+b)^n(a^2+b^2)^((n^2-n)/2)  n odd.
(1)

Velucchi also considers the nondominating queens problem, which consists of placing n queens on an order n chessboard to leave a maximum number U(n) of unattacked vacant cells. The first few values are 0, 0, 0, 1, 3, 5, 7, 11, 18, 22, 30, 36, 47, 56, 72, 82, ... (OEIS A001366). The results can be generalized to k queens on an n×n board.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.