Queens on a prime order board
Then queens problem is to place on ann *n chessboardn queens so that none attacks any other. This means there is only one queen on every horizontal, vertical, and diagonal line.
Whenn is a prime number >= 5, it is sufficient to place the queens on a line that has slope 2, 3, 4, ..., n - 2. (The slope cannot be 1 because that's a diagonal. And it cannot be n - 1 because n- 1 = -1 modn is also a diagonal.) [1]
Here we imagine opposite edges of the board being joined together. Geometrically, this makes the chessboard a torus (donut). Algebraically, the points on a line of slope s have the coordinates
(a +k,b +ks)
where addition is carried out modn.
All solutions to then queens problem have this form whenn = 5. Some solutions will have this form for larger prime values of n but not all.
For example, whenn = 7, here is a solution where all the queens are on a line of slope 2.

But here is another solution where the queens do not all lie on a line of constant slope.

- Formulating eight queens as a SAT problem
- Queens on a donut
- Solving a chess puzzle with Claude and Prolog
[1] W. H. Bussey. A Note on the Problem of the Eight Queens. The American Mathematical Monthly, Vol. 29, No. 7 (August 1922), pp. 252-253
The post Queens on a prime order board first appeared on John D. Cook.