%I #25 Nov 30 2023 11:32:34
%S 1,4,18,669,170440,238773358,1436110601256,36028800332480074,
%T 3731252530927004638384,1584563250286480205777197264,
%U 2746338834266357074512496613490144,19358285762613388151183577985346072926384,553468075675608205710323628035216140349636855680
%N Number of tilings of the n X n torus, using diagonal lines to connect the gridpoints.
%H Peter Kagey, <a href="/A295223/b295223.txt">Table of n, a(n) for n = 1..57</a>
%H Peter Kagey, <a href="/A295223/a295223.pdf">The eighteen tilings of the 3 x 3 torus</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.
%e For n = 3, the following four tilings are considered equivalent:
%e *---*->-+---+ +---+->-*---* *---*->-+---+ +---+->-+---+
%e | / | \ | \ | | / | / | \ | | \ | / | / | | / | \ | \ |
%e *---*---+---+ +---+---*---* *---*---+---+ *---*---+---+
%e ^ / | / | \ ^ = ^ / | \ | \ ^ = ^ \ | / | \ ^ = ^ \ | / | / ^
%e +---+---+---+ +---+---+---+ +---+---+---+ *---*---+---+
%e | \ | / | / | | \ | \ | / | | / | \ | \ | | \ | / | \ |
%e +---+->-+---+ +---+->-+---+ +---+->-+---+ +---+->-+---+
%e The transformations are horizontal reflection, shifting to the right, and shifting down.
%t a[n_] := 1/(8*n^2)*(DivisorSum[n, Function[d, DivisorSum[n, Function[c, EulerPhi[c] EulerPhi[d] 2^(n^2/LCM[c, d])]]]] + If[OddQ[n], n^2*2^((n^2 + 1)/2), n^2/4 (3*2^(n^2/2) + 2^((n^2 + 4)/2))] + 2*If[EvenQ[n], n/2*DivisorSum[n, Function[c, EulerPhi[c] (2^(n^2/LCM[2, c]) + If[OddQ[c], 0, 2^(n^2/c)])]], n*DivisorSum[n, Function[c, EulerPhi[c]*If[OddQ[c], 0, 2^(n^2/c)]]]] + If[OddQ[n], 0, n^2 (2^(n^2/4))] + 2*n*DivisorSum[n, Function[d, EulerPhi[d]*Which[OddQ[d], 2^((n^2 + n)/(2 d)), EvenQ[d], 2^(n^2/(2 d))]]])
%Y Cf. A255016, A295229.
%K nonn
%O 1,2
%A _Peter Kagey_, Nov 17 2017