Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

SudokuHints

Guides

  • Sudoku Hints

Symbols

  • BackTracking
  • CellSize
  • ColoredCells
  • CommonCellColor
  • Disks
  • DoubleCandidates
  • EditSudoku
  • EnterClues
  • EnterSudoku
  • ExportSudoku
  • ExtraBlockCellColor
  • ExtraBlocks
  • HiddenPairs
  • HiddenQuadruples
  • HiddenSingles
  • HiddenTriples
  • Hints
  • IncludeCandidates
  • LockedCandidates
  • MaxSolutions
  • MaxSteps
  • MonitorSteps
  • Pairs
  • ReduceSudoku
  • SetDisplay
  • ShowCandidates
  • ShowInfo
  • Singles
  • SolveSudoku
  • SudokuFromString
  • Sudoku
  • SudokuToString
  • ThreeGroups
  • Triples
  • YWing
  • $AllRules
  • $Sudoku
FredSimons`SudokuHints`
SolveSudoku
​
SolveSudoku
[sudoku]
looks for a solution of the sudoku.
​
Details and Options

Examples  
(4)
Basic Examples  
(4)
In[1]:=
str="200030080078000001040006000054000700000009003100000240005000900080010000000020030";
This sudoku cannot be solved by our rules:
In[2]:=
sud=
ReduceSudoku
[str]
Clues22,HiddenPairs1,LockedCandidates1,Solved0
Out[2]=
Contents cannot be rendered at this time; please try again later
We can find a solution:
In[3]:=
SolveSudoku
[sud]
Out[3]=
Contents cannot be rendered at this time; please try again later
This does not automatically mean that the sudoku has exactly one solution. If we want to be sure, we have to look for two solutions, using backtracking:
In[4]:=
SolveSudoku
str,
MaxSolutions
2
SolveSudoku
::steps
:The result was found in 73 steps.
Out[4]=

Contents cannot be rendered at this time; please try again later

This is a list with only one solution, so the solution is unique.
​
We can solve the empty sudoku:
In[1]:=
SolveSudoku
StringJoin[Table["0",81]],
MaxSolutions
4
SolveSudoku
::steps
:The result was found in 52 steps.
Out[1]=

Contents cannot be rendered at this time; please try again later
,
Contents cannot be rendered at this time; please try again later
,
Contents cannot be rendered at this time; please try again later
,
Contents cannot be rendered at this time; please try again later

​
The next sudoku has 16 clues. Since for a standard sudoku at least 17 clues are required for a unique solution, this sudoku may have none or more than one solution.
In[1]:=
sud=
SudokuFromString
["800000000000070000000800000076005900000000007000003000000700000700018000040000570"]
Out[1]=
Contents cannot be rendered at this time; please try again later
In[2]:=
ReduceSudoku
[sud]
Clues16,Solved0
Out[2]=
Contents cannot be rendered at this time; please try again later
In[3]:=
SolveSudoku
[sud]
SolveSudoku
::nosol
:This sudoku has no solutions.
Out[3]=
Contents cannot be rendered at this time; please try again later
​
The function SolveSudoku can be used with multi sudoku's:
In[1]:=
sud=
SudokuFromString
["007200060000900400400000059000008700052000000409000305800060400008000070306020107004007000000081000032600009040000000000000100030010000000070000000940000009000000000034018000000000080036400000940100085060000800000070000000007000002000001040000080000001000090310009004730700300000520900080005040680000006090002085000350100070100000073000200015006000000041000000000000200&&0L0L010D1$3n3z"]
After some time, we have to abort the next command:
With ReduceSudoku, we see that there is a unique solution:

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com