![]() ![]() This places the game of solving rank-n Sudoku puzzles in a class of problems that computer scientists have named NP-complete. As the rank of a Sudoku increases from n to n+1, the extra computational time needed to find a solution increases quite fast. Find two different solutions.įor 4×4 Sudoku, a case-by-case analysis utilizing the two essentially different grids proves that a well-formed puzzle must have a minimum of four distinct digits in the givens.įinally, it is intriguing to note that even though there are computer programs that can quickly and easily solve rank-3 Sudokus by employing a backtracking method, solving a Sudoku of arbitrary rank n is a much more difficult problem. The next exercise illustrates this with a specific example.Įxercise: The following rank-2 Sudoku has 2 2-1=3 distinct digits among the givens. ![]() Recall that the converse of a true statement is not necessarily true. It is important to note that this is not the same as stating that if a Sudoku of rank n has n 2-1 distinct digits in the givens, then it is well-formed. The fact discussed above can be restated as follows: If a Sudoku of rank n is well-formed, then it must have n 2-1 distinct digits among the givens. In particular, for the usual rank-3 Sudoku, at least 3 2-1=8 distinct digits must be used in the givens for the puzzle to be well-formed otherwise, the puzzle will have more than one solution. This is because if we had a rank-n puzzle where only n 2-2 symbols were used and we found a solution, then interchanging the places of the two symbols missing from the givens would result in another, different solution. However, the minimum number of givens for which a rank-3 Sudoku can be well-formed is not known.Įxercise: Can you come up with a Sudoku puzzle that is not well-formed?Īnother interesting question (that you may have considered when solving the above exercise) is how many distinct symbols need to be used among the givens for a puzzle to be well-formed? It turns out that for a Sudoku of rank n, at least n 2-1 distinct symbols must be used for the puzzle to have a unique solution. There are examples of rank-3 Sudoku puzzles with 17 givens that are well-formed. A Sudoku puzzle can have more than one solution, but in this case the kind of logical reasoning we described while discussing solving strategies may fall short. Which will be used to code up a grid generator.The Math Behind Sudoku Some More Interesting FactsĪ well-formed Sudoku puzzle is one that has a unique solution. I'm 100% confident that finding an grid generator algorithm is NP-hard because it requires solving the general Sudokus in order to gain the cyclic permutation pattern. How would I show that? What kind of proof should I use to prove that finding a Grid generator algorithm is just as hard as solving arbitrary Sudoku? I already proven (trivially proven) that code-Sudoku is NP-complete, but I'm not sure how to prove that creating valid Grid generators is NP-complete as well. N4 = input('Enter correct number for unfilled value) N3 = input('Enter correct number for unfilled value) N2 = input('Enter correct number for unfilled value) N1 = input('Enter correct number for unfilled value) #code counts amount of unfilled values and prints anotherĬode of n amount of empty values asking for input #counting unfilled values and converting in O(n) time. Algorithm print("Enter your n^2 x n^2 puzzle and I'll convert it into Here, I take any arbitrary n^2 x n^2 puzzle and convert it into an equivalent instance but in code. ![]() In other words, solving "code-Sudoku" is NP-complete. I found out I can take any □^2□□^2 general Sudoku Problem and convert it into a puzzle written in code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |