OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..10000
Michael Somos, Rational Function Multiplicative Coefficients
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
G.f.: (1 + x + x^2)^2 / (1 - x^2)^2 = 1 + x * (x + 2) * (2*x + 1) / (1 - x^2)^2. a(-n) = -a(n) except a(0) = 2.
Euler transform of length 3 sequence [2, 2, -2].
a(n) = 2 * b(n) where b() is multiplicative with b(2^e) = 5 * 2^(e-2) if e>0, b(p^e) = p^e if p>2.
a(2*n + 1) = 4*n + 2, a(2*n) = 5*n except a(0) = 2.
a(n) = (9+(-1)^n)*n/4 = (n/2)*A010710(n+1) for n>0. - Bruno Berselli, Mar 24 2011
EXAMPLE
G.f. = 1 + 2*x + 5*x^2 + 6*x^3 + 10*x^4 + 10*x^5 + 15*x^6 + 14*x^7 + 20*x^8 + ...
MATHEMATICA
LinearRecurrence[{0, 2, 0, -1}, {1, 2, 5, 6, 10}, 80] (* Harvey P. Dale, Jul 03 2017 *)
PROG
(PARI) {a(n) = (n==0) + n * ([5/2, 2] [n%2 + 1])};
(PARI) {a(n) = if( n==0, 1, sign(n) * polcoeff( (1 + x + x^2)^2 / (1 - x^2)^2 + x * O(x^abs(n)), abs(n)))};
(Magma) I:=[2, 5, 6, 10]; [1] cat [n le 4 select I[n] else 2*Self(n-2) - Self(n-4): n in [1..30]]; // G. C. Greubel, Aug 14 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael Somos, Feb 14 2011
STATUS
approved