A054247: Number of n X n binary matrices under action of dihedral group of the square D_4.
(*半念浮生*)
g[list_] := {list, Reverse /@ list, Reverse@list,
Reverse /@ Reverse@list};
g1[list_] := (g[list]~Join~g[Transpose@list]) // Sort;
(tmp = GatherBy[Partition[#, 3] & /@ Tuples[{0, 1}, 9],
g1]) // Length(* 3*3 *)
Map[MatrixPlot[#, Frame -> None, FrameTicks -> None, Mesh -> All,
ColorFunction -> "Monochrome",
ImageSize -> Scaled[.04]] &, tmp, {2}]
% // Flatten // Length
I wonder if there is a more general way to solve this problem? For example, use the knowledge of group theory to solve it.
Bibliography: 应用组合学 P298
g
,DeleteDuplicatesBy[Union[g@#, g@Transpose@#] &]@ Tuples[{0, 1}, {n, n}] // Length
? $\endgroup$