%I #32 Mar 21 2022 08:51:58
%S 1,5,72,1380,31920,861840,26611200,925404480,35805369600,
%T 1526139014400,71066912716800,3590219977344000,195589552648089600,
%U 11430978821982720000,713448513897799680000,47363888351558338560000
%N Absolute value of determinant of n X n matrix whose entries are the integers from 1 to n^2 spiraling outward, ending in a corner.
%C If n == 0 or 1 (mod 4), the sign of the determinant will be independent of the orientation of the spiral. For n == 2 or 3 (mod 4), the sign will be reversed when the orientation is rotated by 1/4 or flipped on the horizontal or vertical axis. - _Franklin T. Adams-Watters_, Dec 31 2013
%C This distribution of the integers is sometimes known as Ulam's spiral, although that is sometimes reserved for when the primes are marked out in some way. - _Franklin T. Adams-Watters_, Dec 31 2013
%H Gaurav Bhatnagar, Christian Krattenthaler, <a href="https://arxiv.org/abs/1704.02859">Spiral determinants</a>, arXiv:1704.02859 [math.CO], 2017.
%F a(n) = (2*n^2-3*n+3) (2n-2)!/(2 (n-1)!) = A096376(n-1)*A000407(n-2), n>1. - Conjectured by _Dean Hickerson_, Jan 30 2003. Proved in the article by Bhatnagar and Krattenthaler.
%F D-finite with recurrence (2*n^2-7*n+8)*a(n) -2*(2*n-3)*(2*n^2-3*n+3)*a(n-1)=0. - _R. J. Mathar_, May 03 2019
%e n=2, det=-5: {1 2 / 4 3 }.
%e n=3, det=72: {7 8 9 / 6 1 2 / 5 4 3 }.
%e n=4, det=-1380: { 7 8 9 10 / 6 1 2 11 /5 4 3 12 / 16 15 14 13 }.
%e n=5, det=31920: { 21 22 23 24 25 / 20 7 8 9 10 / 19 6 1 2 11 /18 5 4 3 12 / 17 16 15 14 13 }
%t M[0, 0] = 1;
%t M[i_, j_] := If[i <= j,
%t If[i + j >= 0, If[i != j, M[i + 1, j] + 1, M[i, j - 1] + 1],
%t M[i, j + 1] + 1],
%t If[i + j > 1, M[i, j - 1] + 1, M[i - 1, j] + 1]
%t ]
%t M[n_] := If[EvenQ[n],
%t Table[M[i, j], {j, n/2, -n/2 + 1, -1}, {i, -n/2 + 1, n/2}],
%t Table[M[i, j], {j, (n - 1)/2, -(n - 1)/2, -1}, {i, -(n - 1)/2, (n - 1)/2}]]
%t a[n_]:=Det[M[n]] (* _Christian Krattenthaler_, Apr 19 2017 *)
%o (Maxima) A079340(n):=if n=1 then 1 else (2*n^2-3*n+3)*(2*n-2)!/(2*(n-1)!)$
%o makelist(A079340(n),n,1,30); /* _Martin Ettl_, Nov 05 2012 */
%Y Cf. A078475, A023999, A067276, A052182.
%K nonn,easy
%O 1,2
%A Kit Vongmahadlek (kit119(AT)yahoo.com), Jan 03 2003
%E Extended by _Robert G. Wilson v_, Jan 25 2003