OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
G. Nebe, E. M. Rains and N. J. A. Sloane, Self-Dual Codes and Invariant Theory, Springer, Berlin, 2006.
E. M. Rains and N. J. A. Sloane, Self-dual codes, pp. 177-294 of Handbook of Coding Theory, Elsevier, 1998 (Abstract, pdf, ps).
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
G.f.: (1 - x + x^3 - x^5 + x^6)/((1-x)^2 * (1-x^2)). - Ralf Stephan, Apr 29 2014
a(n) = (1/8) * (2*n^2 + 3*(-1)^n - 4*n + 21) for n >= 3. - Ralf Stephan, Apr 29 2014 [Corrected by Pontus von Brömssen, May 30 2023]
From G. C. Greubel, Jan 05 2024: (Start)
a(n) = (1/8)*(2*n^2 - 4*n + 21 + 3*(-1)^n) - 2*[n=0] - [n=1] - [n=2].
E.g.f.: (1/8)*( (21 - 2*x + 2*x^2)*exp(x) + 3*exp(-x) ) - (2 + x + x^2/2). (End)
MATHEMATICA
LinearRecurrence[{2, 0, -2, 1}, {1, 1, 2, 3, 5, 6, 9}, 50] (* Harvey P. Dale, Nov 06 2016 *)
PROG
(Magma) [n le 2 select Floor((n+2)/2) else (2*n^2-4*n+21+3*(-1)^n)/8: n in [0..50]]; // G. C. Greubel, Jan 05 2024
(SageMath) [(2*n^2-4*n+21+3*(-1)^n)/8 - ((4-n)//2)*int(n<3) for n in range(51)] # G. C. Greubel, Jan 05 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved