I'm down to 1.4 sec myself, but that's on a 3 GHz, so I admit your code is far faster than mine!
And by the way: The number of S-classes and T-classes as well as (once again) the number of grids for 3x3-sudoku is now confirmed.
Let A be the group of automorphisms acting on 3x3-sudoku grids, given by symbol permutations, band permutations, stack permutations, permutations of rows within a given band and of columns within a given stack. For any grid G, let K(G) be the automorphisms in A leaving G fixed. Then #[G] = #A/#K(G) = 9!*6^8/#K(G) where [G] is the equivalence class of G modulo A.
I have written a program that runs through all T-classes, and for each class [G] (where G is a grid) finds the size of K(G), and wether G is transpose-invariant (i.e. [G]=[transpose(G)]). The result of the counting:
- Code: Select all
N | Classes [G] where #K(G)=N
+-------------+------------
| not trans.- | transpose-
| invariant | invariant
----+-------------+------------
1 | 10944340774 | 23201
2 | 1050496 | 637
3 | 14672 | 36
4 | 4378 | 29
6 | 2442 | 6
9 | 84 | 1
12 | 172 | 0
18 | 168 | 4
27 | 4 | 1
36 | 22 | 2
54 | 20 | 1
108 | 4 | 0
162 | 2 | 0
324 | 0 | 1
If the numbers on row i are denoted (N_i,X_i,Y_i) then
- The number of T-classes = Sum (X_i + Y_i) = 10945437157
- The number of S-classes = Sum (X_i/2 + Y_i) = 5472730538
- The number of S-classes that split into two T-classes = Sum X_i/2 = 5472706619
- The number of S-classes with only one T-class = Sum Y_i = 23919
- The total number of grids = 9! * 6^8 * Sum (X_i+Y_i)/N_i = 6670903752021072936960
- The total number of transpose-invariant grids = 9! * 6^8 * Sum Y_i/N_i = 14347728127918080