OFFSET
1,2
COMMENTS
LINKS
Muniru A Asiru, Table of n, a(n) for n = 1..10000
Bruno Berselli, An interpretation of initial terms.
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
From Colin Barker, Jul 17 2013: (Start)
a(n) = (16 + 4*n + 2*n^2)/16 for n even, a(n) = (3 + 4*n + n^2)/8 for n odd.
G.f.: -x*(x^4 - x^3 - x^2 + x + 1) / ((x - 1)^3*(x + 1)^2). (End)
a(n) = A000217(floor(n+1)/2) + (1 + (-1)^n)/2. - Bruno Berselli, Aug 20 2019
MAPLE
seq(coeff(series(-x*(x^4-x^3-x^2+x+1)/((x-1)^3*(x+1)^2), x, n+1), x, n), n = 1 .. 60); # Muniru A Asiru, Dec 21 2018
MATHEMATICA
Table[Sum[If[EvenQ[k], 1, (k - 1)/2], {k, 0, n}], {n, 60}] (* Jon Maiga, Dec 21 2018 *)
LinearRecurrence[{1, 2, -2, -1, 1}, {1, 2, 3, 4, 6}, 60] (* Harvey P. Dale, Oct 13 2024 *)
PROG
(GAP) a:=[];; for n in [1..60] do if n mod 2=0 then Add(a, (16+4*n+2*n^2)/16); else Add(a, (3+4*n+n^2)/8); fi; od; a; # Muniru A Asiru, Dec 21 2018
(Magma) T:=func<i | i*(i+1)/2>; [T(Floor((n+1)/2))+(1+(-1)^n)/2: n in [1..60]]; // Bruno Berselli, Aug 20 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Rick L. Shepherd, Oct 29 2007
STATUS
approved