OFFSET
0,2
COMMENTS
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
Kival Ngaokrajang, Illustration of initial terms
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
a(0) = 1; a(1) = 5; a(2) = 9; for n >= 3, a(n) = a(n-1)+((n-1)/2+1)^2, if n = even; otherwise a(n) = a(n-1)+2*((n-1)^2/4+(n-1)+7/4).
From Colin Barker, Apr 17 2015: (Start)
a(n) = (n^3+5*n^2+14*n+16)/8 for n even and n>1.
a(n) = (n^3+4*n^2+11*n+8)/8 for n odd and n>1.
G.f.: (2*x^8-3*x^7-5*x^6+9*x^5+5*x^4-8*x^3+x^2+4*x+1) / ((x-1)^4*(x+1)^3).
(End)
MATHEMATICA
f[n_] := Block[{t = {5, 9}}, For[i = 3, i <= n, i++, If[OddQ@ i, AppendTo[t, t[[i - 1]] + ((i - 1)/2 + 1)^2], AppendTo[t, t[[i - 1]] + 2 ((i - 1)^2/4 + (i - 1) + 7/4)]]]; {1}~Join~t]; f@ 48(* Michael De Vlieger, Apr 17 2015 *)
PROG
(PARI) a(n) = if(n<=0, 1, if(n<=1, 5, if(n<=2, 9, if(Mod(n, 2)==0, a(n-1)+2*((n-1)^2/4+(n-1)+7/4), a(n-1)+((n-1)/2+1)^2))))
for (n=0, 100, print1(a(n), ", "))
(PARI) Vec((2*x^8-3*x^7-5*x^6+9*x^5+5*x^4-8*x^3+x^2+4*x+1)/((x-1)^4*(x+1)^3) + O(x^100)) \\ Colin Barker, Apr 18 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Kival Ngaokrajang, Apr 17 2015
STATUS
approved