OFFSET
1,2
COMMENTS
Also, the maximum detour index of any bipartite graph on n^2 nodes. - Andrew Howroyd, Dec 20 2017
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
Eric Weisstein's World of Mathematics, Detour Index
Eric Weisstein's World of Mathematics, Grid Graph
Index entries for linear recurrences with constant coefficients, signature (2,4,-10,-5,20,0,-20,5,10,-4,-2,1).
FORMULA
a(2n-1) = 32*n^3*(n-1)^3, a(2n) = 4*n^2*(8*n^4 - 5*n^2 + 1). - Andrew Howroyd, Dec 20 2017
From Colin Barker, Dec 21 2017: (Start)
G.f.: 16*x^2*(1 + 14*x + 73*x^2 + 160*x^3 + 224*x^4 + 160*x^5 + 73*x^6 + 14*x^7 + x^8) / ((1 - x)^7*(1 + x)^5).
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>12.
(End)
a(n) = A296819(n^2). - Andrew Howroyd, Dec 23 2017
MATHEMATICA
a[n_] := If[OddQ[n], (1/2)*(n-1)^3*(n+1)^3, (1/4)*n^2*(2*n^4 - 5*n^2 + 4)]; Array[a, 30] (* Jean-François Alcover, Dec 21 2017, after Andrew Howroyd *)
LinearRecurrence[{2, 4, -10, -5, 20, 0, -20, 5, 10, -4, -2, 1}, {0, 16, 256, 1744, 6912, 21744, 55296, 126016, 256000, 487600, 864000, 1467216}, 30] (* Eric W. Weisstein, Dec 21 2017 *)
CoefficientList[Series[16 x (1 + 14 x + 73 x^2 + 160 x^3 + 224 x^4 + 160 x^5 + 73 x^6 + 14 x^7 + x^8)/((1 - x)^7 (1 + x)^5), {x, 0, 20}], x] (* Eric W. Weisstein, Dec 21 2017 *)
PROG
(PARI) a(n)=((n^2)*(n^2-1)^2 - if(n%2, (n+1)^2*(n-1)^2, n^2*(n^2/2-1)))/2; \\ Andrew Howroyd, Dec 20 2017
(PARI) concat(0, Vec(16*x^2*(1 + 14*x + 73*x^2 + 160*x^3 + 224*x^4 + 160*x^5 + 73*x^6 + 14*x^7 + x^8) / ((1 - x)^7*(1 + x)^5) + O(x^40))) \\ Colin Barker, Dec 21 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Eric W. Weisstein, Dec 20 2017
EXTENSIONS
Terms a(8) and beyond from Andrew Howroyd, Dec 20 2017
STATUS
approved