A141843 Triangular array T(n,k) (n >= 1, 1 <= k <= n) read by rows: row n gives the lexicographically earliest solution to the n queens problem, or n zeros if no solution exists. The k-th queen is placed in square (k, T(n, k)).
1, 0, 0, 0, 0, 0, 2, 4, 1, 3, 1, 3, 5, 2, 4, 2, 4, 6, 1, 3, 5, 1, 3, 5, 7, 2, 4, 6, 1, 5, 8, 6, 3, 7, 2, 4, 1, 3, 6, 8, 2, 4, 9, 7, 5, 1, 3, 6, 8, 10, 5, 9, 2, 4, 7, 1, 3, 5, 7, 9, 11, 2, 4, 6, 8, 10, 1, 3, 5, 8, 10, 12, 6, 11, 2, 7, 9, 4, 1, 3, 5, 2, 9, 12, 10
Offset: 1
Examples
Triangle begins: n\k [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [1] 1; [2] 0, 0; [3] 0, 0, 0; [4] 2, 4, 1, 3; [5] 1, 3, 5, 2, 4; [6] 2, 4, 6, 1, 3, 5; [7] 1, 3, 5, 7, 2, 4, 6; [8] 1, 5, 8, 6, 3, 7, 2, 4; [9] 1, 3, 6, 8, 2, 4, 9, 7, 5; [10] 1, 3, 6, 8, 10, 5, 9, 2, 4, 7; [11] 1, 3, 5, 7, 9, 11, 2, 4, 6, 8, 10; [12] 1, 3, 5, 8, 10, 12, 6, 11, 2, 7, 9, 4; [13] ... For n=8, the lexicographically smallest solution for the 8-queens problem is 1,5,8,6,3,7,2,4.
Links
- Matthias Engelhardt, Table of n, a(n) for n = 1..1892 (previous version of Colin Pearson enlarged)
- Matthias R. Engelhardt, The old nQueens problem.
- Matteo Fischetti, Domenico Salvagnin, Chasing First Queens by Integer Programming, 2018.
- Matteo Fischetti, Domenico Salvagnin, Finding First and Most-Beautiful Queens by Integer Programming, arXiv:1907.08246 [cs.DS], 18 Jul 2019.
- Colin S. Pearson, CSP Queens - Counting Queen-placements.
- Martin S. Pearson, Queens On A Chessboard.
- Wikipedia, Eight Queens Puzzle.
Programs
-
PARI
row(n)={my(ok(p,a,d)=!for(j=1,n, bittest(d,p[j]-j+n)&& return; bittest(a,p[j]+j)&& return; d+=1<<(p[j]-j+n); a+=1<<(p[j]+j))); for(i=if(n>2,n-3)!*n,n!, ok(numtoperm(n,i))&& return(numtoperm(n,i))); vector(n)} \\ M. F. Hasler, Jan 20 2019
Formula
Limit_{n->oo} Sum_{k=1..n} T(n,k)*x^k = A065188(x).
Extensions
We extended this sequence by adding new terms 1036 to 1128 relating to two further puzzle solutions, for board size 46 X 46 (a new solution) and for board size 47 X 47. Given that the k-th queen is placed in square (k, a(n, k)), we have added the terms (1, a(46, 1)) to (47, a(47, 47)). - Colin S. Pearson, Nov 04 2011
Comments rewritten by Matthias Engelhardt, Jan 28 2018
Comments