OFFSET
0,6
COMMENTS
Also the number of main classes of diagonal Latin squares of order 2n+1 that contain a cyclic Latin square. Compare A341585.
FORMULA
a((p-1)/2) = A341585((p-1)/2) for odd prime p.
EXAMPLE
a(12) = 3 since there are A123565(25) = 10 cyclic diagonal Latin squares whose first row is in ascending order. Each of these is uniquely defined by the step between rows and form 5 pairs by horizontal or vertical reflection (negating the step between rows). Up to exchanging rows with columns there are 3 distinct classes, so a(12) = 3.
PROG
(PARI)
iscanon(n, k, g) = k <= vecmin(g*k%n) && k <= vecmin(g*lift(1/Mod(k, n))%n)
a(n)={if(n==0, 1, my(m=2*n+1); sum(k=1, m-1, gcd(m, k)==1 && gcd(m, k-1)==1 && gcd(m, k+1)==1 && iscanon(m, k, [1, -1])))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Andrew Howroyd, May 02 2021
STATUS
approved