%I #17 Feb 16 2025 08:33:52
%S 288,1744,7200,21744,56448,126016,259200,487600,871200,1467216,
%T 2384928,3716944,5644800,8306944,11985408,16875216,23392800,31800400,
%U 42688800,56397616,73738368,95137344,121680000,153887344,193179168,240177616,296704800,363488400
%N Detour index for the n X n torus grid graph.
%C The n X n torus grid graph is Hamilton-connected for odd n, giving a(n) = n^2*(n^2 - 1)^2/2 for odd n.
%H Colin Barker, <a href="/A296784/b296784.txt">Table of n, a(n) for n = 3..1000</a>
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DetourIndex.html">Detour Index</a>
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TorusGridGraph.html">Torus Grid Graph</a>
%H <a href="/index/Rec#order_12">Index entries for linear recurrences with constant coefficients</a>, signature (2,4,-10,-5,20,0,-20,5,10,-4,-2,1).
%F a(n) = n^2*(n^2 - 1)^2/2 for odd n.
%F a(n) = A296779(n) = n^2*(2*n^4 - 5*n^2 + 4)/4 for even n. - _Andrew Howroyd_, Dec 21 2017
%F From _Colin Barker_, Dec 21 2017: (Start)
%F G.f.: 16*x^3*(18 + 73*x + 160*x^2 + 203*x^3 + 190*x^4 + 69*x^5 - 4*x^6 + 6*x^7 + 10*x^8 - 4*x^9 - 2*x^10 + x^11) / ((1 - x)^7*(1 + x)^5).
%F a(n) = 2*a(n-1) + 4*a(n-2) - 10*a(n-3) - 5*a(n-4) + 20*a(n-5) - 20*a(n-7) + 5*a(n-8) + 10*a(n-9) - 4*a(n-10) - 2*a(n-11) + a(n-12) for n>14.
%F (End)
%t a[n_] := If[OddQ[n], (1/2)*n^2*(n^2 - 1)^2, (1/4)*n^2*(2*n^4 - 5*n^2 + 4)]; Table[a[n], {n, 3, 30}] (* _Jean-François Alcover_, Dec 21 2017, after _Andrew Howroyd_ *)
%t LinearRecurrence[{2, 4, -10, -5, 20, 0, -20, 5, 10, -4, -2, 1}, {288, 1744, 7200, 21744, 56448, 126016, 259200, 487600, 871200, 1467216, 2384928, 3716944}, 20] (* _Eric W. Weisstein_, Dec 21 2017 *)
%t CoefficientList[Series[(16 (18 + 73 x + 160 x^2 + 203 x^3 + 190 x^4 + 69 x^5 - 4 x^6 + 6 x^7 + 10 x^8 - 4 x^9 - 2 x^10 + x^11))/((1 - x)^7 (1 + x)^5), {x, 0, 20}], x] (* _Eric W. Weisstein_, Dec 21 2017 *)
%o (PARI) a(n) = n^2 * if(n%2, (n^2 - 1)^2/2, (2*n^4 - 5*n^2 + 4)/4); \\ _Andrew Howroyd_, Dec 21 2017
%o (PARI) Vec(16*x^3*(18 + 73*x + 160*x^2 + 203*x^3 + 190*x^4 + 69*x^5 - 4*x^6 + 6*x^7 + 10*x^8 - 4*x^9 - 2*x^10 + x^11) / ((1 - x)^7*(1 + x)^5) + O(x^40)) \\ _Colin Barker_, Dec 21 2017
%Y Cf. A296779.
%K nonn,easy,changed
%O 3,1
%A _Eric W. Weisstein_, Dec 20 2017
%E Terms a(8) and beyond from _Andrew Howroyd_, Dec 21 2017