distinct arrangements of d digits [was: semimagic squares: 1, 0, 9, ...]

Eric W. Weisstein eww at wolfram.com
Fri Aug 8 15:27:45 CEST 2003


On Fri, 8 Aug 2003, [windows-1255] æ÷éø ñòéãåá - ã\"ø/Zakir Seidov Ph.D. wrote:

> Eric, and all SeqFans,
> 
> how many are there 
> 3x3 squares modulo rotation/reflection 
> with 1, 2, 3, ..., 9 distinct digits?
> 
> Are you agree with these figures?

Yes.

> How to generate all these  say 45360 distinct squares (for say 8/9 digits)?

For 3x3, you can get away with brute force and a couple of lines of 
Mathematica .

CanonicalizeArray[x_]:=Module[{r,t},
    Sort[{x,Reverse[x],r=Reverse/@x,Reverse[r],t=Transpose[x],Reverse[t],
        r=Reverse/@t,Reverse[r]}][[1]]
]

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

> 3,12,66,378,1890,7560,22680,45360,45360 

Length/@(ADD[3,#]&/@Range[0,9])//Timing
{107.46 Second,{1,3,12,66,378,1890,7560,22680,45360,45360}}

Probably the sequence should be 

%I A087074 
%S A087074 1,1,1,1,2,3,3,1,3,12,66,378,1890,7560,22680,45360,45360,1,3,33,426,
%T A087074 5466,65520
%N A087074 Triangle of numbers of nxn arrays containing the digits 0, 1, ..., n^2 that are rotationally and reflectively distinct
%H A087074 Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Array.html">Array</a>
%A A087074 Zakir Seidov (zakirs(AT)yosh.ac.il), Aug 08, 2003
%O A087074 1,5
%e A087074 1,1; 1,1,2,3,3; 1,3,12,66,378,1890,7560,22680,45360,45360; ...
%e A087074 There is a single distinct 3x3 matrix containing all zeros, so a(3,1)=1.
%e A087074 There are 3 distinct 3x3 matrices containing a 1 and otherwise 0s, so a(3,2)=3.
%e A087074 There are 12 distinct 3x3 matrices containing a single 1, a single 2, and otherwise 0s, so a(3,3)=12.
%K A087074 nonn,more,new,tabl
%C A087074 Contributed and extended by Eric W. Weisstein (eric(AT)weisstein.com).

Cheers,
-E






More information about the SeqFan mailing list