%I #113 Nov 23 2023 08:02:13
%S 1,2,6,102,8548,4211744,8590557312,70368882591744,2305843028004192256,
%T 302231454921524358152192,158456325028538104598816096256,
%U 332306998946229005407670289177772032,2787593149816327892769293535238052808491008
%N Number of n X n binary matrices under action of dihedral group of the square D_4.
%C Arises in the enumeration of "water patterns" in magic squares. [Knecht]
%H Peter E. Francis, <a href="/A054247/b054247.txt">Table of n, a(n) for n = 0..57</a>
%H Peter Kagey and William Keehn, <a href="https://arxiv.org/abs/2311.13072">Counting tilings of the n X m grid, cylinder, and torus</a>, arXiv:2311.13072 [math.CO], 2023.
%H Craig Knecht, <a href="/A054247/a054247.png">102 patterns</a>
%H Craig Knecht, <a href="http://www.knechtmagicsquare.paulscomputing.com/">Knecht Magic Squares Site</a>, see sections 1 and 12.
%H <a href="/index/Gre#groups">Index entries for sequences related to groups</a>
%F a(n) = (1/8)*(2^(n^2)+2*2^(n^2/4)+3*2^(n^2/2)+2*2^((n^2+n)/2)) if n is even and a(n) = (1/8)*(2^(n^2)+2*2^((n^2+3)/4)+2^((n^2+1)/2)+4*2^((n^2+n)/2)) if n is odd.
%e There are 6 nonisomorphic 2 X 2 matrices under action of D_4:
%e [0 0] [0 0] [0 0] [0 1] [0 1] [1 1]
%e [0 0] [0 1] [1 1] [1 0] [1 1] [1 1].
%t f[n_]:=With[{n2=n^2},If[EvenQ[n],(2^n2+2(2^(n2/4))+3(2^(n2/2))+ 2(2^((n2+n)/2)))/8,(2^n2+2(2^((n2+3)/4))+2^((n2+1)/2)+ 4(2^((n2+n)/2)))/8]]; Array[f,15,0] (* _Harvey P. Dale_, Apr 14 2012 *)
%o (PARI) a(n)=(2^n^2+2^((n^2+7)\4)+if(n%2,2^((n^2+1)/2)+2^((n^2+n+4)/2),3*2^(n^2/2)+2^((n^2+n+2)/2)))/8 \\ _Charles R Greathouse IV_, May 27 2014
%o (Python)
%o def a(n):
%o return 2**(n**2-3)+2**((n**2-8)/4)+2**((n**2-6)/2)+2**((n**2-4)/2)+2**((n**2+n-4)/2) if n % 2 == 0 else 2**(n**2-3)+2**((n**2-5)/4)+2**((n**2-5)/2)+2**((n**2+n-2)//2) # _Peter E. Francis_, Apr 12 2020
%Y Column k=2 of A343097.
%Y Cf. A002724, A054407.
%K easy,nonn,nice
%O 0,2
%A _Vladeta Jovovic_, May 04 2000
%E More terms from _Harvey P. Dale_, Apr 14 2012