%I #31 Apr 04 2024 10:45:57
%S 1,0,240,20160,0,319334400,62270208000,0,4979623993344000,
%T 1946321606541312000,0,517040334777699532800000,
%U 155112100433309859840000000,0,229885811837232250818134016000000,230239482316981838896315760640000000,0,82665183731089159437333210700185600000000
%N Number of cyclic diagonal Latin squares of order 2n+1.
%C A cyclic Latin square is a Latin square in which row i is obtained by cyclically shifting row i-1 by d places.
%C Equivalently, a Latin square is cyclic if and only if each row is a cyclic permutation of the first row and each column is a cyclic permutation of the first column.
%C Every cyclic diagonal Latin square is a cyclic Latin square, so a(n) <= A338522(2*n+1).
%C Cyclic diagonal Latin squares exist only for odd orders not divisible by 3. - _Andrew Howroyd_, May 26 2021
%H Eduard I. Vatutin, <a href="http://evatutin.narod.ru/evatutin_ls_euler_func.pdf">Enumerating cyclic Latin squares and Euler totient function calculating using them</a>, High-performance computing systems and technologies, 2020, Vol. 4, No. 2, pp. 40-48. (in Russian)
%H Eduard I. Vatutin, <a href="https://vk.com/wall162891802_2691">Numerical formula between number of cyclic diagonal Latin squares and number of toroidal n-queens problem solutions getting by knight movement</a> (in Russian).
%H E. I. Vatutin, <a href="http://evatutin.narod.ru/evatutin_dls_spec_types_list.pdf">Special types of diagonal Latin squares</a>, Cloud and distributed computing systems in electronic control conference, within the National supercomputing forum (NSCF - 2022). Pereslavl-Zalessky, 2023. pp. 9-18. (in Russian)
%H <a href="https://oeis.org/index/La#Latin">Index entries for sequences related to Latin squares and rectangles</a>.
%F a(n) = A123565(2*n+1) * (2*n+1)!.
%F a(n) = A370672(n) * (2n)!. - _Eduard I. Vatutin_, Mar 13 2024
%e For n=3 there are 6 cyclic Latin squares of order 7 with the first row in ascending order, only 4 of them are diagonal:
%e 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6
%e 2 3 4 5 6 0 1 3 4 5 6 0 1 2 4 5 6 0 1 2 3 5 6 0 1 2 3 4
%e 4 5 6 0 1 2 3 6 0 1 2 3 4 5 1 2 3 4 5 6 0 3 4 5 6 0 1 2
%e 6 0 1 2 3 4 5 2 3 4 5 6 0 1 5 6 0 1 2 3 4 1 2 3 4 5 6 0
%e 1 2 3 4 5 6 0 5 6 0 1 2 3 4 2 3 4 5 6 0 1 6 0 1 2 3 4 5
%e 3 4 5 6 0 1 2 1 2 3 4 5 6 0 6 0 1 2 3 4 5 4 5 6 0 1 2 3
%e 5 6 0 1 2 3 4 4 5 6 0 1 2 3 3 4 5 6 0 1 2 2 3 4 5 6 0 1
%e and 4*7! = 20160 cyclic diagonal Latin squares.
%o (PARI) a(n)={my(m=2*n+1); m!*if(gcd(m, 6)==1, sum(k=1, m, gcd(k^3-k, m)==1))} \\ _Andrew Howroyd_, Apr 30 2021
%Y Cf. A123565 (ordered first row), A338522, A341585 (main classes), A342306, A370672.
%K nonn,easy
%O 0,3
%A _Eduard I. Vatutin_, Nov 02 2020
%E More terms from _Andrew Howroyd_, Apr 30 2021
%E Zero terms for even orders removed by _Andrew Howroyd_, May 26 2021