Array

Author

Eric W. Weisstein
April 15, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Combinatorics/Array.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Array.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Canonicalization

CanonicalizeArray[Transpose[(({{7, 4, 1}, {8, 5, 2}, {9, 6, 3}}))]]

With[{x=(({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}))},Flatten[{#,Reverse[#],r=Reverse/@#,Reverse[r]}&/@{x,Transpose[x]},1]
]

RotationReflectionQ[(({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}})),(({{7, 4, 1}, {8, 5, 2}, {9, 6, 3}}))]

RotationReflectionQ[(({{1, 2, 3}, {4, 5, 6}})),(({{4, 1}, {5, 2}, {6, 3}}))]

RotationReflectionEquivalent[(({{1, 2, 3}, {4, 5, 6}})),(({{3, 2, 1}, {6, 5, 4}}))]

Rotationally/Reflectely Distinct n×n Arrays with Distinct Elements

MatrixForm/@With[{n=2},Union[CanonicalizeArray/@(Partition[#,n]&/@Permutations[Range[n^2]])]]

Length/@Table[Union[CanonicalizeArray/@(Partition[#,n]&/@Permutations[Range[n^2]])],{n,3}]

Rotationally/Reflectely Distinct n×n Arrays with Digits 1, …, d

ADD[n_,d_]:=Union[CanonicalizeArray/@(Partition[#,n]&/@Permutations[Join[Range[d],Table[0,{n^2-d}]]])]

Length/@(ADD[1,#]&/@Range[0,1])

MatrixForm/@ADD[2,#]&/@Range[0,4]

Length/@(ADD[2,#]&/@Range[0,4])

Length/@(ADD[3,#]&/@Range[0,9])//Timing

Length/@(ADD[4,#]&/@Range[0,5])//Timing