New explicit solution to the N-Queens Problem and its relation to the Millennium Problem
NNEW EXPLICIT SOLUTION TO THE N -QUEENS PROBLEMANDITS RELATION TO THE MILLENNIUM PROBLEM DMITRII MIKHAILOVSKII
Abstract.
Using modular arithmetic of the ring Z n +1 we obtain a new short solution to the problem of existenceof at least one solution to the N -Queens problem on an N × N chessboard. It was proved, that these solutions canbe represented as the Queen function with the width fewer or equal to 3. It is shown, that this estimate could notbe reduced. A necessary and sufficient condition of being a composition of solutions a solution is found. Based onthe obtained results we formulate a conjecture about the width of the representation of arbitrary solution. If thisconjecture is valid, it entails solvability of the N -Queens completion in polynomial time. The connection betweenthe N -Queens completion and the Millennium P vs NP Problem is found by the group of mathematicians fromScotland in August 2017.
Introduction
The Millennium Problems are seven problems in mathematics that were stated by the Clay Mathematics Institutein 2000. A correct solution to any of these problems results in a US $1000000 prize being awarded by the instituteto the discoverer. Currently, the only Problem that has been solved is so-called Poincare conjecture. Another ofthese 7 Problems is related to the complexity of algorithms. Among these algorithms, polynomial algorithms arehighlighted. The class of these algorithms is designated by P . Another class of algorithms are the algorithmswhich are able to check in polynomial number of steps that an answer is indeed a solution to a problem. Class ofthese algorithms is designated by N P . The Millennium Problem is the P versus N P problem. In August 2017 agroup of mathematicians from Scotland proved that N -Queens Completion Problem is N P -complete. Namely, ifthis problem can be solved in polynomial time, then P is equal to N P .Our work is devoted to the N -Queens Problem i.e. the well-known problem of placing N chess queens on an N × N chessboard so that no two queens attack each other.C.F. Gauss found 72 solutions for N = 8. But 24 years later J.W.L. Glaisher proved using a method ofdeterminants that for N = 8 there are exactly 92 solutions. The existence of a solution for arbitrary N was provedby different authors using different methods. It was first proved by E. Pauls in 1874. Now the number of differentsolutions Q ( N ) is computed only for 4 (cid:54) N (cid:54)
27. Calculation of Q ( N ) is related to the N -Queens CompletionProblem (if we have m < N queens on the board, is it possible to complete this board to the solution of the N -Queens Problem?). Existing methods of solving the completion problem stop working for N (cid:62) Queen functions with width k which is a map [1 , N ] → [1 , N ] which is defined on a partition of a segment [1 , N ] by k segments and on each ofthem it is linear on subsets of even and odd numbers. A map of positive integers f : S ⊆ [1 , N ] → [1 , N ] we call linear on S , if there exist integers a ∈ [1 , N ], b ∈ [0 , N ], f ( i ) = ai + b (mod N + 1), where i ∈ S .Using this construction we prove the next theorem: The Width Theorem.
For any
N > there exists a solution which can be represented as a Queen function withwidth fewer or equal to . The width of the function in the theorem cannot be reduced, since for N = 15 our program checked that thereare no solutions that can be represented as a Queen function with width 1 or 2. All other solutions by differentauthors have greater width than ours.Next we introduce the concept of composition of solutions, formulate the criterion of being a composition ofsolutions a solution and prove this criterion for the generalization of composition. Generalized composition ofsolutions ( A , A , . . . , A | B | ) ⊗ B is an arrangement which is defined by the following rule C ( | B | ( i −
1) + j ) = | B | ( A j ( i ) −
1) + B ( j ) , where | A i | = | A j | (1 ≤ i < j ≤ | B | ) , ≤ i ≤ | A | , 1 ≤ j ≤ | B | . Theorem.
Generalized composition ( A , A , . . . , A | B | ) ⊗ B of the solutions is a solution if and only if both of thefollowing conditions hold: (1) { B ( i ) − i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | . (2) { B ( i ) + i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | . Sufficiency in this theorem was proved by Polya in 1918 and we prove more complex part — necessity.If A = A = . . . = A | B | , we obtain The Composition Theorem .Further we obtain two new corollaries from the Composition Theorem. a r X i v : . [ m a t h . C O ] M a y nd finally, we introduce definition of Q -irreducible numbers N for which none of the N × N solutions can berepresented as a composition of smaller boards and definition of a fundamental set of solutions which is a set ofarrangements which generate all solutions to the N -Queens Problem by the rotation and reflection of the board.At the end, we formulate the conjecture that solves the N -Queens Problem and the N -Queens Completion forsuch Q -irreducible N that N − Q -irreducible in polynomial time: Conjecture.
If numbers N − and N are Q -irreducible, then there exists a set of fundamental solutions whichcan be represented as a Queen function with a width less or equal to . Our program has checked this conjecture for N up to 14.During the research new theoretical problems regarding prime numbers arise:(1) Are there infinitely many primes of form 2 k l − k, l ∈ N )? This is a generalization of MersennePrimes Problem.(2) Are there infinitely many primes p such that 2 p + 1 is prime too?The paper is organized as follows. In the first section we introduce the new way of representation of queens’arrangements and prove the Width Theorem. In the second section we introduce composition of solutions, considergeneralization of composition and prove the Composition Theorem. In the third section we consider connectionbetween the width and composition and introduce a conjecture which solves the N -Queens Problem and N -QueensCompletion in polynomial time. 1. Width Theorem
Any arrangement A can be represented as a matrix or a permutation: Figure 1.
Arrangement A , | A | = 8 A = ; i A ( i ) 3 1 7 5 8 2 4 6 Notation 1.1.
The size of A is designated by | A | .It is obvious that in any column and any line there must be exactly one queen. It means that the necessarycondition of being an arrangement a solution is being a permutation. Now any ascending diagonal can be charac-terized by constant difference of queen’s line and column. And any descending diagonal can be characterized byconstant sum of queen’s line and column.That is why we can formulate the following well-known statement. Statement 1.2.
Permutation A is a solution to the N -Queens Problem if and only if ∀ (cid:54) i < j (cid:54) N | i − j | (cid:54) = | A ( i ) − A ( j ) | . Now we will introduce the new way of representing solutions. efinition 1.3. A map of positive integers f : S ⊆ [1 , N ] → [1 , N ] we call linear on S , if there exist integers a ∈ [1 , N ], b ∈ [0 , N ], f ( i ) = ai + b (mod N + 1), where i ∈ S . Definition 1.4. A Queen function is a map [1 , N ] → [1 , N ] which is defined on a partition of a segment [1 , N ]by segments and on each of them it is linear on subsets of even and odd numbers. Definition 1.5. The width of the Queen function is the quantity of segments of the partition.It is easy to see that any N × N arrangement of queens can be represented as a Queen function with width N .So that, our aim is to find the upper bound of the estimate of width. The Width Theorem.
For any
N > there exists a solution which can be represented as a Queen function withwidth fewer or equal to .Proof. To prove this theorem we will prove the following 5 lemmas.Nowadays existing solutions for N = 12 k − ×
8. Thissolution is the simplest of the known ones.
Lemma 1.6.
Let N = 12 k − . Then the following Queen function gives a solution A ( i ) = i (mod N + 1) , i ≤ N i + 2 (mod N + 1) , i > N and i is odd i − N + 1) , i > N and i is even . Proof.
For any 1 (cid:54) i (cid:54) N the value of A ( i ) is not 0 since A ( i ) = 2 i (mod N + 1) for i (cid:54) N (cid:54) = 0. For odd i > N suppose opposite. The value A ( i ) = 2 i + 2 (mod N + 1) = 2 i + 2 − N − i + 2 = N + 1, but i > N hence 2 i + 2 > N + 2. For even i suppose opposite. Then A ( i ) = 2 i − N + 1) = 2 i − N − i = N + 3 = 12 k − k − i, j which are set by the same formula A ( i ) (cid:54) = A ( j ). Let i (cid:54) N , j > N .(1) j is odd. Then 2 i = 2 j + 2 − ( N + 1). Then 2( j − i + 1) = N + 1, but N + 1 is odd.(2) j is even. Then 2 i = 2 j − − ( N + 1) or 2( j − i −
1) = N + 1. But N + 1 is odd.Now we will show that | i − j | (cid:54) = | A ( i ) − A ( j ) | . Suppose the opposite.(1) If for i < j A ( i ) and A ( j ) are set by the formula A ( l ) = 2 l (mod N +1), then j − i = 2 j − i or 1 = 2. If theyare set by formula A ( l ) = 2 l +2 (mod N +1), then j − i = 2 j +2 − ( N +1) − i − N +1) = 2( j − i ) or 1 = 2.If they are set by formula A ( l ) = 2 l − N +1), then j − i = 2 j − − ( N +1) − i +2+( N +1) = 2( j − i ).(2) If i (cid:54) N , j > N and j is odd, then j − i = ± (2 i − (2 j + 2 − ( N + 1))) = ± (2 i − j + N − j − i = 2 i − j + N −
1. Then 3( j − i ) = N − k −
5, but 12 k − j − i = 2 j − i − N + 1. Then j − i = N −
1. It is possible only for j = N , i = 1, but then j is even,which is another case.(3) If i (cid:54) N , j > N , j is even, then j − i = ± (2 i − (2 j − − N −
1) = ± (2 i − j + N + 3).(a) j − i = 2 i − j + N + 3. Then 3( j − i ) = N + 3 = 12 k −
1, but 12 k − j − i = 2 j − i − N −
3. Then j − i = N + 3, which is impossible since j (cid:54) n .Thus, | i − j | (cid:54) = | A ( i ) − A ( j ) | and A is a solution and for N = 12 k − (cid:3) Lemma 1.7.
Let N = 6 k or N = 6 k + 4 . Then the following Queen function gives a solution A ( i ) = 2 i (mod N + 1) . Proof.
For any 1 (cid:54) i (cid:54) N the value of A ( i ) is not 0 since N + 1 is not divisible by 2. So all function values will bein range from 1 to N .It will be a permutation: let i (cid:54) N , j > N , suppose that A ( i ) = A ( j ). Then 2 i = 2 j − ( N +1) or 2( i − j ) = N +1,but N + 1 is odd.Now let’s show that this permutation is a solution. Suppose the opposite. Let i > j . Then i − j = | (2 i (mod N + 1)) − (2 j (mod N + 1)) | .(1) i, j (cid:54) N . Then i − j = 2( i − j ) or 1 = 2.(2) i, j > N . Then i − j = 2 i − ( N + 1) − (2 j − ( N + 1)) = 2( i − j ) or 1 = 2.(3) j (cid:54) N , i > N . Then(a) i − j = 2 i − ( N + 1) − j . Then i − j = N + 1 which is impossible.(b) i − j = 2 j − (2 i − ( N + 1)) = 2 j − i + N + 1 or 3( i − j ) = N + 1, but N is not divisible by 3.Thus, | i − j | (cid:54) = | A ( i ) − A ( j ) | and A is a solution and for N = 6 k and N = 6 k + 4 there exists a solution with width1. (cid:3) emma 1.8. Let N = 6 k + 1 or N = 6 k + 5 . Then the following Queen function gives a solution A ( i ) = (cid:40) i (mod N + 1) , i < N i + 1 (mod N + 1) , i > N . Proof.
Obviously, it will be a permutation. Let i < N , j > N . Suppose that A ( i ) = A ( j ) or 2 i = 2 j + 1 − N − i − j = − N or j − i = N , contradiction ( N is not integer).Now we will show that | i − j | (cid:54) = | A ( i ) − A ( j ) | . Suppose the opposite.(1) j < i < N . Then i − j = (2 i (mod N + 1)) − (2 j (mod N + 1)) = 2 i − j or 1 = 2.(2) i > j > N . Then i − j = (2 i +1 (mod N +1)) − (2 j +1 (mod N +1)) = 2 i +1 − ( N +1) − (2 j +1 − ( N +1)) =2 i − j or 1 = 2.(3) j < N , i > N . Then(a) i − j = (2 i + 1 (mod N + 1)) − (2 j (mod N + 1)) = 2 i + 1 − ( N + 1) − j = 2 i − j − N . Then i − j = N , contradiction.(b) i − j = (2 j (mod N + 1)) − (2 i + 1 (mod N + 1)) = 2 j − (2 i + 1 − ( N + 1)) = 2 j − i + N . Then3( i − j ) = N , contradiction because N is not divisible by 3.Thus, | i − j | (cid:54) = | A ( i ) − A ( j ) | and A is a solution and for N = 6 k + 1 and N = 6 k + 5 there exists a solution withwidth 2. (cid:3) Note that { k + 2 | k ∈ N } = { k − | k ∈ N } ∪ { k + 2 | k ∈ N } . Lemma 1.9.
Let N = 12 k + 2 . Then the following Queen function gives a solution A ( i ) = i + 4 (mod N + 1) , i < N and i is odd or i = N i (mod N + 1) , i < N and i is even i + 2 (mod N + 1) , N ≤ i < N. Proof.
For any 1 (cid:54) i (cid:54) N the value of A ( i ) is not 0 since in the first part of the formula i < = N (or A ( N ) = 2) andodd i by the formula 2 i + 4 (cid:54) N < N + 1 or A ( i ) (cid:54) = 0. In the second part i (cid:54) N − i (cid:54) N − < N + 1.In the third part N + 2 (cid:54) i + 2 < N + 2 or 2 i + 2 (mod n + 1) (cid:54) = 0.Now we will show that it is a permutation. For i, j which are set by the same formula A ( i ) (cid:54) = A ( j ).. In othercases(1) i < N and N (cid:54) j < N . Suppose the opposite A ( i ) = A ( j ).(a) i is odd or i = N . Then 2 i + 4 (mod N + 1) = 2 j + 2 (mod N + 1) which is 2 i + 4 = 2 j + 2 − ( N + 1)or 2 j + 2 − ( N + 1) = 2. Then we get 2( j − i + 1) = N + 1 or 2 j = N + 1 which is impossible because n + 1 = 12 k + 3 is odd.(b) i is even. Then 2 i (mod N + 1) = 2 j + 2 (mod N + 1) or 2 i = 2 j + 2 − ( N + 1). And now we get2( j − i + 1) = N + 1 = 12 k + 3 contradiction.(2) i, j < N and i is even, j is odd. Then 2 i (mod N + 1) = 2 j + 4 (mod N + 1) or i − j = 2, but i and j havedifferent parity.Now we will show that | i − j | (cid:54) = | A ( i ) − A ( j ) | . Suppose the opposite. If for i and j A is set by the same formulait is obvious. In other cases(1) j < i < N , j is odd, i is even. Then(a) i − j = (2 i (mod N + 1)) − (2 j + 4 (mod N + 1)) = 2 i − j − i − j = 4, but they have differentparity.(b) i − j = (2 j + 4 (mod N + 1)) − (2 i (mod N + 1)) = 2 j + 4 − i or 3( i − j ) = 4 which is impossible.(2) j < N , j is odd and N (cid:54) i < N . Then(a) i − j = (2 i + 2 (mod N + 1)) − (2 j + 4 (mod N + 1)) = 2 i + 2 − ( N + 1) − (2 j + 4) = 2 i − j − N − i − j = N + 3, impossible.(b) i − j = (2 j + 4 (mod N + 1)) − (2 i + 2 (mod N + 1)) = 2 j + 4 − (2 i + 2 − N −
1) = 2 j − i + N + 3or 3( i − j ) = N + 3 or 3( i − j ) = 12 k + 5, impossible.(3) j < N , j is even and N (cid:54) i < N . Then(a) i − j = (2 i + 2 (mod N + 1)) − (2 j (mod N + 1)) = 2 i + 2 − ( N + 1) − j = 2 i − j − N + 1 or i − j = N −
1, impossible.(b) i − j = (2 j (mod N + 1)) − (2 i + 2 (mod N + 1)) = 2 j − (2 i + 2 − N −
1) = 2 j − i + N − i − j ) = N − i − j ) = 12 k + 1, impossible.Thus, | i − j | (cid:54) = | A ( i ) − A ( j ) | and A is a solution and for N = 12 k + 2 there exists a solution with width 3. (cid:3) emma 1.10. Let N = 6 k + 3 . Then the following Queen function gives a solution A ( i ) = i + 2 (mod N + 1) , i < N − i + 4 (mod N + 1) , i = N − i + 5 (mod N + 1) , i > N − . Proof.
For any 1 (cid:54) i (cid:54) N the value of A ( i ) is not 0 since i < N − , A ( i ) = 2 i (mod N + 1) = 2 i (cid:54) = 0. For i = N − A ( i ) = 2. For N − < i < N − A ( i ) = 2 i + 5 (mod N + 1) = 2 i − N + 4 (cid:54) = 0 and A ( N −
1) = 1, A ( n ) = 3.Now we will show that | i − j | (cid:54) = | A ( i ) − A ( j ) | . Suppose the opposite.(1) i < N − , j = N − . Then j − i = ± (2 − i −
2) = ± i. (a) j − i = 2 i . Then 2 i = j = N − = k +22 = 3 k + 1.(b) j − i = − i . Then i + j = 0.(2) i < N − , N − < j < N −
1. Then j − i = ± (2 i + 5 − N − − i −
2) = ± (2( j − i ) − N + 2) . (a) j − i = 2( j − i ) − N + 2. Then j − i = N − j − i = − j − i ) + N −
2. Then 3( j − i ) = N − k + 1.(3) i < N − , j ≥ N −
1. Then j − i = ± (2 j + 5 − N − − i −
2) = ± (2( j − i ) − N + 1).(a) j − i = 2( j − i ) − N + 1. Then j − i = 2 N − j − i = − j − i ) + 2 N −
1. Then 3( j − i ) = 2 N − k + 5.(4) i = N − , N − < j < N −
1. Then j − i = ± (2 j + 5 − N − −
2) = ± (2 j − N + 2).(a) j − i = 2 j − N + 2. Then j = N − − i = N − − N +12 = N − < N − . (b) j − i = N − − j . Then 3 j = N − i = N − N − = N − < N − .(5) i = N − , j (cid:62) N −
1. Then j − i = ± (2 j + 5 − N − −
2) = ± (2 j − N + 1).(a) j − i = 2 j − N + 1. Then j = 2 N − − i = N − > N .(b) j − i = 2 N − j −
1. Then 3 j = 2 N − i = N − < N − . (6) N − < i < N − j (cid:62) N −
1. Then j − i = ± (2 j + 5 − N − − i − N + 1) = ± (2( j − i ) − N − . (a) j − i = 2( j − i ) − N − . Then j − i = N + 1.(b) j − i = − j − i ) + N + 1. Then 3( j − i ) = n + 1 = 6 k + 4 . Thus, | i − j | (cid:54) = | A ( i ) − A ( j ) | and A is a solution and for N = 6 k + 3 there exists a solution with width 3. (cid:3) Thus, the width theorem is proved by building the examples of Queen functions for arbitrary values of N . (cid:3) Remark 1.11.
The width of the function in the theorem cannot be reduced, since for N = 15 our program checkedthat there are no solutions that can be represented as a Queen function with width 1 or 2.Also, all known solutions (1874 — Glaisher, 1969 — Hoffman, Loessi, Moore, 1991 — Bernhardsson) have agreater width.Here is the example of our solution and the easiest known solution for N = 20. Figure 2.
Author’s solution with width 2
Figure 3.
Bernhardsson’s solution with width 4 . Composition Theorem
Definition 2.1.
Given to arbitrary solutions A and B . Then we can obtain new arrangement by insertion of onearrangement into queens’ positions of another arrangement. The obtained arrangement is called composition A ⊗ B .For example consider two solutions A and B :By we definition of composition we can obtain two new arrangements: Figure 4. A ⊗ B is a solution Figure 5. B ⊗ A is not a solutionIt is easy to see that composition of solutions is not always a solution. Thus we found necessary and sufficientcondition of being a composition of solutions a solution: The Composition Theorem.
Composition A ⊗ B of the solutions A and B is a solution if and only if bothof the following conditions hold: (1) { B ( i ) − i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | . (2) { B ( i ) + i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | . To prove this theorem we will consider more general construction and prove the same criterion for it.
Definition 2.2. Generalized composition of solutions ( A , A , . . . , A | B | ) ⊗ B is an arrangement which is definedby the following rule C ( | B | ( i −
1) + j ) = | B | ( A j ( i ) −
1) + B ( j ) , where | A i | = | A j | (1 ≤ i < j ≤ | B | ) , ≤ i ≤ | A | , 1 ≤ j ≤ | B | .This construction is taken from [2] and firstly introduced by Polya in [7].Obviously, if arrangements ( A , A , . . . , A | B | ) are the same, then we get usual composition of solutions. Theorem 2.3.
Generalized composition ( A , A , . . . , A | B | ) ⊗ B of the solutions is a solution if and only if both ofthe following conditions hold: (1) { B ( i ) − i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | . (2) { B ( i ) + i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | . roof. Sufficiency was proved in 1918 by Polya in [7].We will prove it again and also prove more complex part of this statement — necessity.Note that any integer 1 (cid:54) m (cid:54) | A || B | can be uniquely represented as m = | B | ( i −
1) + j , (1 (cid:54) i (cid:54) | A | ,1 (cid:54) j (cid:54) | B | ). Then for the chessboard | A || B | × | A || B | we will set the queens’ arrangements by the formula C ( | B | ( i −
1) + j ) = | B | ( A j ( i ) −
1) + B ( j ) . Firstly, we will prove that this arrangement is a permutation. It is obvious since for different numbers their mapimages are either in different intervals or in one interval but with different values because A i , B are solutions.Secondly, we will prove that this permutation is a solution. Let 1 (cid:54) r < s (cid:54) | A || B | . We have to prove s − r (cid:54) = ± ( C ( s ) − C ( r )) (cid:54) = ± ( C ( | B | ( i −
1) + j ) − C ( | B | ( i −
1) + j ))) (cid:54) = ± ( | B | ( A j ( i ) −
1) + B ( j ) − | B | ( A j ( i ) − − B ( j )) (cid:54) = ± ( | B | ( A j ( i ) − A j ( i )) + ( B ( j ) − B ( j ))). We get that | B | (( i − i ) ± (( A j ( i ) − A j ( i ))) (cid:54) = ± ( B ( j ) − B ( j )) − ( j − j ) . (1)First, we will prove sufficiency. Suppose the opposite: inequality (1) doesn’t hold. The conditions of the theoremare satisfied. Specifically, integers B ( i ) − i are different modulo | B | and integers B ( i ) + i are different modulo | B | .Then the right-hand part of (1) (now it is equality) is not divisible by | B | and the required equality doesn’t hold.Now we will prove the necessity. We consider cases of different sign before the expression:(1) | B | (( A j ( i ) + i ) − ( A j ( i ) + i )) (cid:54) = ( B ( j ) + j ) − ( B ( j )) + j ) . Suppose the opposite. Such integers j , j , that B ( j ) + j ≡ B ( j ) + j (mod | ) B | exist. Then | B | divides B ( j ) + j − ( B ( j ) + j ). Note that − | B | + 3 (cid:54) B ( j ) + j − ( B ( j ) + j ) (cid:54) | B | −
3. Then B ( j ) + j − ( B ( j ) + j ) = ±| B | . Then we will divide both parts of the inequality by | B | and we get( A j ( i ) + i ) − ( A j ( i ) + i ) (cid:54) = ±
1. What is more ∀ (cid:54) p (cid:54) | B | (cid:54) A p ( i ) + i (cid:54) | A | . Then we arrangein non-decreasing order | A || B | integers A s ( i ) + i so, that ( A j ( i ) + i ) − ( A j ( i ) + i ) (cid:54) = ±
1. There willbe more than | A | − A p ( i ) + i − ( A q ( j ) + j ) (cid:62) | A | −
2. But the largest possible difference is 2 | A | − | B | (( A j ( i ) − i ) − ( A j ( i ) − i )) (cid:54) = ( B ( j ) − j ) − ( B ( j )) − j ) . Suppose the opposite. Such integers j , j , that B ( j ) − j ≡ B ( j ) − j (mod | ) B | exist. Then | B | divides ( B ( j ) − j ) − ( B ( j )) − j ). Note that − | B | + 3 (cid:54) ( B ( j ) − j ) − ( B ( j )) − j ) (cid:54) | B | −
3. Then( B ( j ) − j ) − ( B ( j )) − j ) = ±| B | . Then we will divide both parts of the inequality by | B | and we get( A j ( i ) − i ) − ( A j ( i ) − i ) (cid:54) = ±
1. What is more ∀ (cid:54) p (cid:54) | B | − | A | (cid:54) A p ( i ) − i (cid:54) | A | −
1. Then wearrange in non-decreasing order | A || B | integers A s ( i ) − i so, that ( A j ( i ) − i ) − ( A j ( i ) − i ) (cid:54) = ±
1. herewill be more than | A | − A p ( i ) − i − ( A q ( j ) − j ) (cid:62) | A | −
2. But the largest possible difference is 2 | A | − (cid:3) Proof of The Composition Theorem.
This statement is a special case of the generalized composition theorem2.3. where A = A = . . . = A | B | . (cid:3) The next theorem is proved by Hedayat in [3]:
Statement 2.4 (Hedayat’s Lemma 2.2 in [3]) . A permutation B such that { B ( i ) − i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | and { B ( i ) + i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | exists if and only if gcd( | B | ,
6) = 1 . Using this statement we obtain the following two corollaries.
Corollary 2.5. If A ⊗ B is a solution, then gcd( | B | ,
6) = 1 . The opposite implication does not hold.Proof. If A ⊗ B is a solution, then { B ( i ) − i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | ; { B ( i ) + i (mod | B | ) | (cid:54) i (cid:54) | B |} = Z | B | by the composition theorem. And finally by the previous statement gcd( | B | ,
6) = 1.But the opposite does not hold because for example for | B | = 7 there exists a solution B = (cid:18) (cid:19) , which doesn’t satisfy the required condition. (cid:3) Corollary 2.6. If A ⊗ B is a solution, then C ⊗ B is a solution for any solution C .Proof. Based on the composition theorem, it is easy to see that criterion of being a composition of solutions A ⊗ B doesn’t depend on the first arrangement A . (cid:3) . Connection between width and composition: conjecture
It is easy to see that the width of the composition is quite large and it is impossible to find a constant boundon its width. According to this we introduce the next definition:
Definition 3.1.
Number N is called Q-irreducible , if none of the N × N solutions can be represented as acomposition of smaller boards. Statement 3.2.
Number N is Q -irreducible if and only if N equals either p , or p , or p , or k l , where p isprime and k, l ∈ N .Proof. It is easy to see that if N is equal to either p , or 2 p , or 3 p , or 2 k l , then it is Q -irreducible.Now we prove the necessity. Suppose the opposite. N is neither p or 2 p or 3 p or 2 k l . Firstly, if N = np (where n > A and B , where | A | = n and | B | = p .Secondly, if N = 2 k l s (where s (cid:54) = p ), then s is not divisible by 2 and 3 and consequently gcd( s,
6) = 1. Thus, forsuch N there exists a solution which is composition of smaller boards. (cid:3) Also operation of rotation of the board doesn’t save the width of representation. Thus, we introduce the nextdefinition:
Definition 3.3. A fundamental set of solutions is a set of arrangements which generate all solutions to the N -Queens Problem by the rotation and reflection of the board.Since generalized composition gives lots of solutions with large width, we consider Q -irreducible N . Also a queencan be arranged in the corner of the smaller board and N × N solution can be obtained. That is way N − Q -irreducible. Conjecture 3.4.
If numbers N − and N are Q -irreducible, then there exists a set of fundamental solutions whichcan be represented as a Queen function with a width less or equal to . This conjecture is checked by our program for N up to 14. Currently, the number of solutions is known only forvalues of N (cid:54) · ·
673 is a tripled prime).If this conjecture is correct, then the N -Queens Problem and, consequently, the N -Queens Completion canbe solved in polynomial time. Also then the number of solutions to the N -Queens Problem is bounded by thepolynomial for such Q -irreducible N that N − Q -irreducible.Based on the conjecture, new problem arise: are there infinitely many integers, satisfying the condition of theconjecture?Let N = 2 k l . Then N − N − k l − k, l ∈ N )? This is a generalization of MersennePrimes Problem, because it is easy to see that for l = 0 it is the Mersenne Primes Problem.And the second problem is the next one: are there infinitely many primes p such that 2 p + 1 is prime too? Acknowledgments
The author would like to thank Dr. of Science (Habilitation) Stanislav Kublanovsky for problem statement andhelpful discussion. Author is also grateful to Nikita Tepelin for assistance in writing programs.
References [1] I.P. Gent, C. Jefferson, P. Nightingale.
Complexity of n -Queens Completion , Journal of Artificial Intelligence Research 59 (2017)815 – 848.[2] I. Rivin, I. Vardi and P. Zimmerman. The n -Queens Problem , The American Mathematical Monthly, Vol. 101, No. 7 (Aug. - Sep.,1994), pp. 629-639.[3] A. Hedayat. A Complete Solution to the Existence and Nonexistence of Knut Vik Designs and Orthogonal Knut Vik Designs ,Journal of Combinatorial Theory (A) 22, 331-337 (1977).[4] B. Abramson.
Divide and Conquer under Global Constraints: A Solution to the N-Queens Problem , Journal of Parallel andDistributed Computing, 6, 649-662 (1989).[5] J. Bell, B. Stevens.
A survey of known results and research areas for n -queens , Discrete Mathematics 309 (2009) 1–31.[6] E.J. Hoffman, J.C. Loessi and R.C. Moore. Constructions for the Solution of the m Queens Problem , Mathematics Magazine, Vol.42, No. 2 (Mar., 1969), pp. 66-72.[7] G. Polya.
Uber die “doppelt-periodischen” Losungen des n-Damen-Problems , in: W. Ahrens (Ed.), Mathematische Unterhaltungenund Spiele, vol. 2, 2nd ed., B.G. Teubner, 1918, pp. 364–374
School 564, Saint Petersburg, 190005 Russia
E-mail address : [email protected]@gmail.com