Skip to search boxSkip to navigationSkip to main content

Solving a sudoku puzzle with Mathematica

Output:
Contribution to journal
Article
Professional

Information

Output type

Output:
Contribution to journal
Article
Professional

Original language

English

Pages from-to (Number of pages)

Pages 1-24

Journal (Volume, Issue Number)

Mathematica in Education and Research (Volume 10, Issue 4)

Publication milestones

  • Published - 2005

Publication status

Published - 2005

ISSN

1065-2965

Abstract

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.