OFFSET
0,2
COMMENTS
Arises in studying A266569.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
From Colin Barker, Apr 11 2016: (Start)
a(n) = 2*a(n-2)-a(n-4) for n>3.
G.f.: x*(4+x) / ((1-x)^2*(1+x)^2).
(End)
a(n) = (5*n - (-1)^n*(3*n + 4) + 4)/4. - Ilya Gutkovskiy, Apr 11 2016
MAPLE
f:=n->if n mod 2 = 0 then n/2 else 2*n+2; fi;
[seq(f(n), n=0..100)];
MATHEMATICA
Table[(5 n - (-1)^n (3 n + 4) + 4)/4, {n, 0, 70}] \\ Ilya Gutkovskiy, Apr 11 2016
PROG
(PARI) concat(0, Vec(x*(4+x)/((1-x)^2*(1+x)^2) + O(x^50))) \\ Colin Barker, Apr 11 2016
(PARI) a(n) = if (n % 2, 2*n+2, n/2); \\ Michel Marcus, Apr 11 2016
(Python)
for n in range(0, 10**3):
if(not n%2):print((int)(n/2))
else:print(2*n+2)
# Soumil Mandal, Apr 11 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Apr 10 2016
STATUS
approved