π€ AI Summary
This work proposes a unified probabilistic modeling and Markov chain Monte Carlo (MCMC) sampling framework for solving Sudoku puzzles and constructing higher-order magic squares (e.g., 8Γ8, 10Γ10). By formulating a probabilistic graphical model that favors βvalid attempts,β the method designs a Markov chain over the space of 9Γ9 matrices to efficiently sample configurations that automatically satisfy Sudoku constraints or the equal-sum conditions on rows, columns, and diagonals required for magic squares. Integrating statistical modeling with stochastic sampling, this approach substantially extends the applicability of MCMC methods to combinatorial puzzle generation and solving. The framework successfully achieves automated solutions for standard Sudoku instances and enables the construction of various high-order magic squares, outperforming conventional search-based strategies in both flexibility and efficacy.
π Abstract
The sudoku puzzles have a long history, with variations going back more than a hundred years, but its current and perhaps surprising world-wide prominence goes back to certain initiatives and then puzzle-generating computer programmes from just after 2000. To solve a sudoko puzzle, a statistician can put up a probabilitymodel on the enormous space of $9\times9$ matrix possibilities, constructed to favour `good attempts', and then engineer a Markov chain to sample a long enough chain of sudoku table realisations from that model, until the solution is found. The methods work also for other types of puzzles, like constructing `magic squares' with wished-for properties (sums of rows, columns, diagonals equal, etc.), as is also illustrated in this article; via magic models and equally magic Markov chains I find impressively magic $8\times8$ and $10\times10$ squares.