login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the number of rotation-reflection inequivalent solutions to the all-ones lights out problem on an n X n square.
5

%I #30 Apr 02 2018 09:29:35

%S 1,1,1,5,1,1,1,1,43,1,10,1,1,5,1,43,1,1,8356,1,1,1,2080,5,1,1,1,1,136,

%T 131720,1,131720,8356,5,10,1,1,1,536911936,1,1,1,1,5,1,1,134225920,1,

%U 43,43,1,1,1,5,1,1,1,1,524800,1,137439609088,2099728,1,33564704,549756338176,1,536911936,1,43,1,2080,1,1,5,1,1,1,1,2305843011898064896

%N a(n) is the number of rotation-reflection inequivalent solutions to the all-ones lights out problem on an n X n square.

%C Reflected and rotated solutions are considered identical.

%D See A075462 for references.

%H Zhao Hui Du, <a href="/A075463/b075463.txt">Table of n, a(n) for n = 1..1000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LightsOutPuzzle.html">Lights Out Puzzle</a>

%t a[n_, i_, j_ ] := Table[If[Total[Abs[{i, j} - {r, s}]] <= 1, 1, 0], {r, n}, {s, n}] //Flatten

%t a[n_, k_ ] := a[n, Quotient[k + n - 1, n], Mod[k, n, 1]]

%t m[n_ ] := a[n, # ] & /@ Range[n^2]

%t ker[n_ ] := NullSpace[m[n], Modulus -> 2]

%t b[n_ ] := Table[1, {n^2}]

%t sol[n_ ] := LinearSolve[m[n], b[n], Modulus -> 2];

%t allSolutions[n_ ] := Module[{s, k},

%t s = sol[n];

%t k = ker[n];

%t Mod[(s + # ) & /@ (Total[(#*k)] & /@ Tuples[{0, 1}, Length[k]]), 2]

%t ] //Sort

%t MatrixRotate[m_ ] := Transpose[Reverse[m]]

%t MatrixRotate[m_, n_ ] := Nest[MatrixRotate, m, Mod[n, 4]]

%t DihedralOrbit[m_ ] := Union@Join[

%t MatrixRotate[m, # ] & /@ Range[0, 3],

%t MatrixRotate[Reverse[m], # ] & /@ Range[0, 3]

%t ]

%t essentialSolutions[n_ ] := Module[{as},

%t as = Partition[ #, n] & /@ allSolutions[n];

%t Union[as, SameTest -> (MemberQ[DihedralOrbit[ #1], #2] &)]

%t ]

%t Length[essentialSolutions[ # ]] & /@ Range[16]

%t (* _Jacob A. Siehler_ *)

%o (PARI)H(n)={

%o my(r);

%o r=matrix(n,n,X,Y,Mod(0,2));

%o for(u=1,n,r[u,u]=Mod(1,2));

%o for(u=1,n-1,r[u,u+1]=Mod(1,2);r[u+1,u]=Mod(1,2));

%o r

%o }

%o E(n)={

%o my(r);

%o r=matrix(n,n,X,Y,Mod(0,2));

%o for(u=1,n,r[u,u]=Mod(1,2));

%o r

%o }

%o b(n)={

%o vector(n,X,Mod(1,2))~

%o }

%o a(n)={

%o my(x0,x1,tmp,y,z,mH,vb,v0,v1,yb,zb);

%o my(A159257,A075462,A075463,a2,a3,a4,a5,tm,tb);

%o x0=E(n);mH=H(n);x1=mH;vb=b(n);

%o y=matrix(n,n);yb=vector(n);

%o z=matrix(n,n);zb=vector(n);

%o v0=vb;v1=mH*vb+v0;

%o y[1,]=x0[1,];yb[1]=Mod(0,2);

%o y[2,]=x1[1,];yb[2]=v0[1];

%o z[1,]=x0[n,];zb[1]=Mod(0,2);

%o z[2,]=x1[n,];zb[2]=v0[n];

%o for(u=2,n-1,

%o tmp=mH*x1+x0;x0=x1;x1=tmp;

%o y[u+1,]=x1[1,];z[u+1,]=x1[n,];

%o tmp=mH*v1+v0+vb;v0=v1;v1=tmp;

%o yb[u+1]=v0[1];zb[u+1]=v0[n]

%o );

%o x1=mH*x1+x0;

%o A159257 = n-matrank(x1);

%o A075462=2^A159257;

%o tm=matrix(2*n,n,X,Y,Mod(0,2));tb=vector(2*n,X,Mod(0,2))~;

%o for(u=1,n,tm[u,]=x1[u,];tb[u]=v1[u]);

%o for(u=1,n,

%o tm[n+u,u]=Mod(1,2);tm[n+u,n-u+1]+=Mod(1,2);tb[n+u]=Mod(0,2)

%o );

%o a2=matinverseimage(tm,tb);

%o if(length(a2)==0, a2=0, a2=2^(n-matrank(tm)));

%o for(u=1,n,tm[n+u,]=y[u,];tb[n+u]=yb[u];tm[n+u,u]+=Mod(1,2));

%o a3=matinverseimage(tm,tb);

%o if(length(a3)==0, a3=0, a3=2^(n-matrank(tm)));

%o for(u=1,n,tm[n+u,]=y[n+1-u,];tb[n+u]=yb[n+1-u];tm[n+u,u]+=Mod(1,2));

%o a4=matinverseimage(tm,tb);

%o if(length(a4)==0, a4=0, a4=2^(n-matrank(tm)));

%o for(u=1,n,tm[n+u,]=y[u,]+z[n+1-u,];tb[n+u]=yb[u]+zb[n+1-u]);

%o a5=matinverseimage(tm,tb);

%o if(length(a5)==0, a5=0, a5=2^(n-matrank(tm)));

%o A075463=(A075462+2*(a2+a3+a4)+a5)/8

%o } \\ _Zhao Hui Du_, Mar 29 2014

%Y Cf. A075462, A075464.

%K nonn,nice,hard

%O 1,4

%A _Eric W. Weisstein_, Sep 17 2002

%E a(19)-a(29) from _Jacob A. Siehler_, Apr 29 2008

%E Terms a(30) and beyond from _Zhao Hui Du_, Mar 24 2014