# Is there an algorithm for 3x3 sudokus without backtracking? [closed]

From what I can see on Wikipedia and the Internet at large, all sudoku solving algorithms (including human ones) employ some kind of EXPTIME backtracking search for some sudokus.

1. Are there any SAT solving algorithms that determine satisfiability in worst-case EXPTIME, which only require a worst-case POLYTIME subset of operations for sudokus on $$n^2\times n^2$$ grids of $$n\times n$$ blocks, with $$n=3$$ and a single solution (a subset of UNAMBIGUOUS SAT).

2. Would such an algorithm be a stepping stone to raise the lower bound for e.g., graph vertex coloring from k>2 to k>3. Or would it just be considered an oddity.

I am mostly interested in the extent of the POLYTIME subset of operations of such an algorithm and any actual proof that an algorithm indeed solves all instances of 3x3 sudokus, not just experimental evidence.

The papers I have come across so far, are somewhat lacking in the sample set (e.g., the assumption that the number of clues correlates to the hardness is simply unfounded). No analysis is given that correlates the hardness of a sudoku to identifiable structural properties (like the XOR loops that make some problems hard for CDCL).

CSP algorithms seem to be best suited for such questions, but do not provide much insight into the structure of a specific problem instance.

To illustrate the context of my question, here are two papers which explicitly identify POLYTIME subsets of the applied algorithm:

Helmut Simonis, Sudoku as a Constraint Problem, CP Workshop on Modeling and Reformulating Constraint Satisfaction Problems, 2005, pages 13-28. In this paper sudokus are categorized with regard to how many solutions were obtained "search free".

I. Lynce, J. Ouaknine, Sudoku as a SAT problem, in 9th International Symposium on Artificial Intelligence and Mathematics AIMATH'06, January 2006. However, the sample sudokus (only 17 clue sudokus) are very weak, which explains the result, that only polynomial operations were necessary.

• As your question concerns a finite set of instances, it does not make much sense. For example, there is the trivial non-backtracking algorithm that simply checks all possible 9x9 Latin squares. Jun 18, 2020 at 18:21
• what does "polynomial" mean when you're talking about 3x3? even a complete brute-force is technically speaking $O(1)$. Jun 18, 2020 at 18:25
• I augmented the question accordingly. I am asking about the specific behavior of an algorithm on a subset of problems. However, the algorithm must be able to handle other problem sizes. Jun 18, 2020 at 19:26
• @AmeerJ an algorithm has a worst-case time complexity in relation to the input size. That is the "polynomial" I am talking about. Limiting the input set to a specific size for a specific case has no bearing on the worst-case running time. Jun 18, 2020 at 19:31
• @wolfmanx You don't "limit" the input size. Consider an algorithm that answers "undecided" whenever the input is larger than a 3×3 Sudoku, and otherwise solves it using a lookup table. This accepts all inputs, runs in constant time, uses no backtracking, and satisfies all the requirements. Jun 20, 2020 at 7:37

Solving a Sudoku puzzle is equivalent to deciding whether there is a valid graph vertex coloring using $$k$$ colors, where $$k = 9$$ in your $$3 \times 3$$ Sudoku instance. The graph coloring problem is known to be NP-complete for values of $$k > 2$$, so a non-trivial, non-backtracking algorithm for $$3 \times 3$$ Sudoku would be very surprising.
• An algorithm that tests whether the graph has ≤ 81 vertices, if so tries all possible 9-colorings, and if not gives up would fit the original question's requirements, and take constant time (assuming the number of vertices is directly accessible, otherwise at most linear to count vertices), but with a very big constant, something like $9^{81}$. Jun 18, 2020 at 20:04
• There are also non-trivial non-backtracking algorithms for graph coloring in time $2^n$ (see Koivisto FOCS 2006) and again this is a constant time bound when restricted to $3\times 3$ sudoku. Jun 19, 2020 at 4:35