OFFSET
0,2
COMMENTS
The bisections of the first differences of {a(n)} give A001844 (the centered triangular numbers n^2+(n-1)^2).
Quasipolynomial of order 2. - Charles R Greathouse IV, Dec 07 2011
Also, the number of 3 X 3 magic squares with elements from {0,...,n} and with duplicate elements allowed. If [[a,b,c], [d,e,f], [g,h,i]] satisfies the property in the description of this sequence, then [[h,a,f], [c,e,g], [d,i,b]] is a magic square, and conversely. - David Radcliffe, Apr 13 2020
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
From Frank Ellermann: (Start)
even: a(2*n) = (4*n^3 + 6*n^2 + 8*n + 3)/3.
odd: a(2*n-1) = (4*n^3 + 2*n)/3. (End)
From Colin Barker, Mar 29 2013: (Start)
a(n) = ((1+n)*(9+3*(-1)^n+4*n+2*n^2))/12.
G.f.: (x^2+1)^2 / ((x-1)^4*(x+1)^2). (End)
E.g.f.: (1/12)*(3*(1 - x)*exp(-x) + (9 + 21*x + 12*x^2 + 2*x^3)*exp(x)). - G. C. Greubel, Jan 07 2017
MATHEMATICA
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 2, 7, 12, 25, 38}, 50] (* G. C. Greubel, Jan 07 2017 *)
PROG
(PARI) a(n)=if(n%2, 4*n^3+2*n, 4*n^3+6*n^2+8*n+3)/3 \\ Charles R Greathouse IV, Dec 07 2011
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
John W. Layman, Jan 26 2001
STATUS
approved