r/GraphTheory • • Sep 13 '26

An interesting problem based on the solvability of a Sudoku puzzle.

Post image

A 9X9 board follows standard Sudoku rules i.e. no two numbers can repeat in the same horizontal row, vertical column or 3x3 sub-square, now 9 numbers 1...9 are randomly scattered throughout the entire board without repetition. Since the numbers are all unique the board is always trivially valid with no need for additional checks, the question now is what percentage of these configurations are solvable. (they may have more than one solution)

Note:-

i) A valid set of clues following Sudoku rules may not always be solvable as it may create dead ends later.

ii) There are 6.67 sextillion(6.67 x 10^21) completed Sudoku board configurations.

We can also generalise this problem for any N^2 x N^2 board following sudoku rules and having N^2 clues scattered randomly throughout the entire board without repetition, Interestingly for N=2 i.e. a 4x4 board we get 67.03% solvability this can be verified by solving all possible configurations as there arent that many really, about 16!/12!(43680) ways, though it isnt possible to use brute force computation for larger values of N, I tried to solve this problem using combinatrics but I feel graph theory would have a better answer to this problem.

18 Upvotes

24 comments sorted by

1

u/Durris Sep 14 '26

Unless I'm misunderstanding your question, the answer is 0. No board with less than 17 givens is a valid and solvable sudoku since all puzzles must, by definition, have a single solution.

1

u/New-Economist-4924 Sep 14 '26

By valid I meant the board cant be filled to completion without any conflicts.

1

u/_Jack_Of_All_Spades Sep 14 '26

If it can be filled more than 1 way then it's not valid.

1

u/New-Economist-4924 Sep 15 '26

I clearly said that it can have more than one solution just being able to fill the entire board without conflicts is "valid", this is a math question, not like I am trying to change sudoku rules.

1

u/_Jack_Of_All_Spades Sep 15 '26

Then I don't know what you mean by "solvable" None of them will ever have any conflicts. The only issue is that there are too few constraints to ever solve the puzzle. Very few configurations will even give you enough constraints to fill in one or two additional digits, uniquely.

1

u/New-Economist-4924 Sep 15 '26

Wrong there are few arrangements where although initially there wont be any conflicts but the board is impossible to fill without causing conflicts like if 1 to 8 are all on a single in a line and 9 is on a different row in the same column as an empty cell it would cause conflicts as the empty cell can not be filled with a 9 any longer.

1

u/Durris Sep 14 '26

In your post you state that you are following standard Sudoku rules, so I would edit that. Another question, you state that the boards are, "always trivially valid." Could you explain what you mean?

1

u/LitespeedClassic Sep 14 '26

Yall, are being a bit dense. OP means that certain placements of 1 through 9, without any further number placements have already ruled out any possible solution. But some can have an additional set of givens placed so that the board is solvable. Let a placement of 1–9 be given. Call it hopeless if there is no solved puzzle with those digits placed. OP wants to know what percentage of placements of 1 through 9 are hopeless. 

1

u/Durris Sep 15 '26

I'm being dense for taking OP's word when they say, "standard Sudoku rules?" You are right, I should have just assumed that I knew what they meant like you did when they had pretty clear guidance. The answer, based on the rules of sudoku, is 0%

0

u/[deleted] Sep 15 '26

[deleted] — view deleted comment

1

u/LitespeedClassic Sep 15 '26

This is in a Graph Theory subreddit though. Valid should have the normal meaning a mathematician would mean. I guess that's how I immediately read it, since I am not in the sudoku solving community. As a mathematician, it was immediately obvious to me what OP meant, and I think the mathematical meaning, not the in-game sudoku practitioner meaning, is proper to this sub. But now I guess I understand why some people didn't understand it. Maybe the algorithm showed them this post but they were sudoku people and not mathematicians.

And I was replying to someone who was replying to OP clarifying what they meant and doubling down on not understanding them, which was annoying.

1

u/andarmanik Sep 14 '26

The fact that 17 always results in a unique solution doesn’t make any claims of the rest. Yes, some of the 16’s don’t have unique results but some do.

1

u/Durris Sep 14 '26

17 is the minimum number of given cells to have a valid sudoku. All potential puzzles with 16 or fewer given cells will always have either, multiple solutions, or no solution.

1

u/andarmanik Sep 14 '26

Just doubled check and you’re right.

1

u/crb233 Sep 15 '26

Seems to me that uniqueness of the solution is just a common convention and good practice rather than a hard and fast rule. Either way, I think the intent of OPs question is clear

1

u/Express_Pop1488 Sep 15 '26

It's almost assuredly 100%

1

u/TacoPi Sep 15 '26

There are some counterexamples.

Fill a row/column with 1-8 but leave one cell empty. Then put the 9 in another cell of the same 3x3 book as the empty cell.

1

u/_Jack_Of_All_Spades Sep 15 '26

Why can't you do this for N=2? The prompt says N=2 has 100% solvability.

1

u/TacoPi Sep 15 '26 edited Sep 15 '26

Well, I’m at a loss. Maybe I don’t understand the prompt.

/u/New-Economist-4924 do you have any clarification?

Why would this N=2 not be generated and the found invalid?

1 2 | _ _

_ _ | 3 4

_ _ | _ _

_ _ | _ _

1

u/New-Economist-4924 Sep 15 '26

Sorry I made a mistake there, actually for N=2 the solvability is 67.03%.

1

u/Express_Pop1488 Sep 15 '26

Are there any other easy to see counterexamples? That's a good one that I missed. I haven't thought much about this but I can't see any others 

1

u/TacoPi Sep 15 '26

It also works with 1-8 in the book and the nine further out the row/column of the empty cell.

I think you have to have 6-8 numbers in a row/column/book such that it has 2/3 full sections, and then you put at least 1 of the remaining numbers in a book/row/column intersecting the empty section. I don’t think it works (fails?) any other way.

I think OP’s question is solvable with a relatively short expression, but I think it would take me an hour I don’t have to write it out without errors.

1

u/Durris Sep 15 '26

You can make an invalid puzzle with as few as 5 known digits. Any 3 digits in one row/column of a 3x3 box and then 2 of the same digit in the other two rows/columns of the 3x3 boxes in line with the originally places 3 digits. If you wanted to not use any repetitive digits, as in OP's post, I'm not sure if there is a way to do it with fewer than 7. But with 7 digits, take any 3 place in a row/column of a box, place 3 more in the next box in line with the previously placed 3 digits but one row/column over, then place the 7th digit in line but next box and one more row/column over.

1

u/Express_Pop1488 Sep 15 '26

Sorry why is this a contradiction? Is this what you mean: 123|---|---,---|456|---,---|---|7--......? I don't see the contradiction here. With repeating digits the problem scopes out of control, the different digits is the easiest case imo. I don't think you can get a contradiction with 8 numbers. The counters with 9 are the only ones that seem obvious 

1

u/Durris Sep 15 '26

Sorry, put the two groupings of 3 given digits in the same row/column. Forgot we aren't looking at uniqueness.