Wolfram Library Archive


Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings
Title

Solving a sudoku puzzle with Mathematica
Author

Fred Simons
Journal / Anthology

Mathematica in Education and Research
Year: 2005
Volume: 10
Issue: 4
Page range: 1-24
Description

A typical sudoku puzzle is 9×9 grid, divided in a square blocks, in which at some positions a number between a and a is filled in. This is an example: We want to fill in the grid so that every row of 9, every column of 9, and every a box each contains all the digits 1 though 9. Equivalently, each digit must appear only once in any given row, column or a box. The sudoku solver I present here is a fast solver. It solves a typical a newspaper problem in a fraction of a second. But it can do more. It can find all solutions of a puzzle or some of them. A good sudoku puzzle has only one solution, but not all sudoku puzzles are in this sense good. Further, it is not restricted to only 9×9 puzzles. Problems of size 16×16 and larger can be tackled as well. It is therefore a flexible solver. It is easy to implement extra rules in the solver and to test their effect on finding the solution.
Subject

*Mathematics > Recreational Mathematics