%I #44 Nov 30 2023 12:05:49
%S 2,3,3,4,7,4,6,13,13,6,8,34,36,34,8,13,78,158,158,78,13,18,237,708,
%T 1459,708,237,18,30,687,4236,14676,14676,4236,687,30,46,2299,26412,
%U 184854,340880,184854,26412,2299,46
%N Table read by antidiagonals: number of toroidal m X n binary arrays, allowing rotation and/or reflection of the rows and/or the columns.
%H G. C. Greubel, <a href="/A222188/b222188.txt">Table of n, a(n) for the first 100 antidiagonals, flattened</a>
%H S. N. Ethier, <a href="http://arxiv.org/abs/1301.2352">Counting toroidal binary arrays</a>, arXiv:1301.2352 [math.CO], 2013 and <a href="https://cs.uwaterloo.ca/journals/JIS/VOL16/Ethier/ethier2.html">J. Int. Seq. 16 (2013) #13.4.7</a>.
%H S. N. Ethier and Jiyeon Lee, <a href="http://arxiv.org/abs/1502.03792">Counting toroidal binary arrays, II</a>, arXiv:1502.03792v1 [math.CO], Feb 12, 2015 and <a href="https://cs.uwaterloo.ca/journals/JIS/VOL18/Lee/lee6.html">J. Int. Seq. 18 (2015) # 15.8.3</a>.
%H S. N. Ethier and Jiyeon Lee, <a href="http://arxiv.org/abs/1510.06947">Parrondo games with two-dimensional spatial dependence</a>, arXiv:1510.06947 [math.PR], 2015.
%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. See p. 3.
%e Array begins:
%e 2, 3, 4, 6, 8, 13, 18, 30, ...
%e 3, 7, 13, 34, 78, 237, 687, 2299, ...
%e 4, 13, 36, 158, 708, 4236, 26412, 180070, ...
%e 6, 34, 158, 1459, 14676, 184854, 2445918, 33888844, ...
%e 8, 78, 708, 14676, 340880, 8999762, 245619576, 6873769668, ...
%e ...
%t b1[m_, n_] := Sum[EulerPhi[c]*EulerPhi[d]*2^(m*n/LCM[c, d]), {c, Divisors[ m]}, {d, Divisors[n]}]/(4*m*n); b2a[m_, n_] := If[OddQ[m], 2^((m+1)*n/2) /(4*n), (2^(m*n/2) + 2^((m+2)*n/2))/(8*n)]; b2b[m_, n_] := DivisorSum[n, If[# >= 2, EulerPhi[#]*2^((m*n)/#), 0]&]/(4*n); b2c[m_, n_] := If[OddQ[ m], Sum[If [OddQ[n/GCD[j, n]], 2^((m+1)*GCD[j, n]/2) - 2^(m*GCD[j, n]), 0], {j, 1, n-1}]/(4*n), Sum[If[OddQ[n/GCD[j, n]], 2^(m*GCD[j, n]/2) + 2^((m+2)*GCD[j, n]/2) - 2^(m*GCD[j, n]+1), 0], {j, 1, n-1}]/(8*n)]; b2[m_, n_] := b2a[m, n] + b2b[m, n] + b2c[m, n]; b3[m_, n_] := b2[n, m]; b4oo[m_, n_] := 2^((m*n-3)/2); b4eo[m_, n_] := 3*2^(m*n/2 - 3); b4ee[m_, n_] := 7*2^(m*n/2-4); a[m_, n_] := Module[{b}, If [OddQ[m], If [OddQ[n], b = b4oo[m, n], b = b4eo[m, n]], If[OddQ[n], b = b4eo[m, n], b = b4ee[m, n]]]; b += b1[m, n] + b2[m, n] + b3[m, n]; Return[b]]; Table[a[m - n+1, n], {m, 1, 10}, {n, 1, m}] // Flatten (* _Jean-François Alcover_, Dec 05 2015, adapted from _Michel Marcus_'s PARI script *)
%o (PARI)
%o odd(n) = n%2;
%o b1(m,n) = sumdiv(m, c, sumdiv(n, d, eulerphi(c)*eulerphi(d)*2^(m*n/lcm(c,d))))/(4*m*n);
%o b2a(m,n) = if (odd(m), 2^((m+1)*n/2)/(4*n), (2^(m*n/2)+2^((m+2)*n/2))/(8*n));
%o b2b(m,n) = sumdiv(n, d, if (d>=2, eulerphi(d)*2^((m*n)/d), 0))/(4*n);
%o b2c(m,n) = if (odd(m), sum(j=1, n-1, if (odd(n/gcd(j,n)), 2^((m+1)*gcd(j,n)/2)-2^(m*gcd(j,n))))/(4*n), sum(j=1, n-1, if (odd(n/gcd(j,n)), 2^(m*gcd(j,n)/2)+2^((m+2)*gcd(j,n)/2)-2^(m*gcd(j,n)+1)))/(8*n));
%o b2(m,n) = b2a(m,n) + b2b(m,n) + b2c(m,n);
%o b3(m,n) = b2(n,m);
%o b4oo(m,n) = 2^((m*n - 3)/2);
%o b4eo(m,n) = 3*2^(m*n/2 - 3);
%o b4ee(m,n) = 7*2^(m*n/2 - 4);
%o a(m,n) = {if (odd(m), if (odd(n), b = b4oo(m,n), b = b4eo(m,n)), if (odd(n), b = b4eo(m,n), b = b4ee(m,n))); b += b1(m,n) + b2(m,n) + b3(m,n); return (b);}
%o \\ _Michel Marcus_, Feb 13 2013
%Y Rows give A000029, A222187, A222189, A222190, A222191.
%Y Main diagonal is A209251.
%Y Cf. A184271.
%K nonn,tabl
%O 1,1
%A _N. J. A. Sloane_, Feb 12 2013