4
$\begingroup$

I'm looking to find how many uniquely enumerated $4\times4$ Sudoku grids exist. I am aware that there are other questions with solutions to this question, however I am asking again as there seem to be conflicting answers online. Some say $384$ whilst some say $288$.

I make my solution to be 384, as I see that there are $4!$ ways of enumerating the first (top left) $2\times2$ block, and then there are $2!$ ways of enumerating the remaining cells of each of the first column, second column, first row and second row. Once the first block and the adjacent blocks (blocks two and three, if you will) are fully enumerated, the fourth block (bottom right) can only be enumerated in one way due to the restrictions on number placement caused by the enumeration of blocks 2 (top right) and 3 (bottom left).

From this, I therefore make my total number of possible enumerations to be: $$4!\times2!\times2!\times2!\times2!=384.$$

It is clear that quite a few others have calculated it in a slightly different way and made their solution to be 288. This doesn't make sense to me as it seems that the total should be divisible by 8, as the any given enumerated grid should have 8 symmetries (rotations and flips) which are all equally valid sudoku enumerations.

Is my calculation incorrect or are some of the answers online incorrect?

Edit: I made a typo initially and wrote 388 instead of 288. I was concerned that 8 did not divide 388, but it does in fact divide 288 - which makes the issue of divisibility by 8 go away.

$\endgroup$
1
  • 1
    $\begingroup$ See the EXAMPLE section of OEIS A107739. $\endgroup$ Commented Feb 16, 2021 at 18:40

2 Answers 2

5
$\begingroup$

Not all of your $384$ possibilities actually work. For example one of your $384$ choices seems to be

$\begin{matrix} 1&2&|&3&? \\ 3&?&|&2&? \\ -&-&+&-&- \\ 2&3&|& ? & ? \\ ?&?&|& ? & ? \end{matrix}$

forcing

$\begin{matrix} 1&2&|&3&4 \\ 3&4&|&2&1 \\ -&-&+&-&- \\ 2&3&|& 1/4 & ? \\ 4&1&|& ? & 2/3 \end{matrix}$

but it is impossible to complete the grid.

Your argument about $8$ symmetries might fail if there is a pattern which is rotationally symmetric with a $180^\circ$ turn, which there is:

$\begin{matrix} 1&2&|&3&4 \\ 3&4&|&1&2 \\ -&-&+&-&- \\ 2&1&|& 4 & 3 \\ 4&3&|& 2 & 1 \end{matrix}$

$\endgroup$
1
  • $\begingroup$ Though $288=36\times 8$ so divisibility by $8$ is not really an issue $\endgroup$ Commented Feb 16, 2021 at 15:34
0
$\begingroup$

It's easy to write a program to find all valid grids by brute force, and verify that there are indeed only $288$ grids. There is no slick counting argument to arrive at this number that I know of.

I do now know who claims that there are $384$ grids, but perhaps there are people who simply claim that $384$ is an easily calculable upper bound.

Here's my quick and dirty code.

def is_valid(grid):
    for col in range(4):
        if len(set([grid[i][col] for i in range(4)])) < 4:
            return False
    for q in range(4):
        (i,j) = (q % 2, q // 2)
        box = grid[2*i][2*j:2*j+2] + grid[2*i+1][2*j:2*j+2]
        if len(set(box)) < 4:
            return False
    return True 

from itertools import permutations, product 

count = 0
for r1,r2,r3,r4 in product(permutations(range(4)), repeat = 4):
    grid = [r1,r2,r3,r4]
    if is_valid(grid):
        count += 1
print(count)
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.