login
A256137
a(2) = 1; a(3) = 4; for n >= 4, a(n) = 2 + Sum_{i=4..n} d(i), where d(i) = i for even i, d(i) = i-3 for odd i.
1
1, 4, 6, 8, 14, 18, 26, 32, 42, 50, 62, 72, 86, 98, 114, 128, 146, 162, 182, 200, 222, 242, 266, 288, 314, 338, 366, 392, 422, 450, 482, 512, 546, 578, 614, 648, 686, 722, 762, 800, 842, 882, 926, 968, 1014, 1058, 1106, 1152, 1202, 1250, 1302, 1352, 1406
OFFSET
2,2
FORMULA
a(2) = 1; a(3) = 4; for n >= 4, a(n) = 2 + Sum_{i=4..n} d(i), where d(i) = i for even i, d(i) = i-3 for odd i.
From Colin Barker, Jul 12 2015 and Aug 20 2015: (Start)
a(n) = (5+3*(-1)^n-4*n+2*n^2)/4 for n>3.
a(n) = (n^2-2*n+4)/2 for n even and n>3.
a(n) = (n^2-2*n+1)/2 for n odd and n>3.
a(n) = 2*a(n-1)-2*a(n-3)+a(n-4) for n>6.
G.f.: x^2*(2*x^5-5*x^4+2*x^3+2*x^2-2*x-1) / ((x-1)^3*(x+1)).
(End)
MATHEMATICA
Prepend[Table[2 + Sum[If[EvenQ@ i, i, i - 3], {i, 3, n}], {n, 3, 48}], 1] (* Michael De Vlieger, Jul 12 2015 *)
Join[{1, 2, 6, 8, 14, 18}, LinearRecurrence[{2, 0, -2, 1}, {26, 32, 42, 50}, 50]] (* Vincenzo Librandi, Jul 16 2015 *)
PROG
(PARI) a=4; print1("1, ", a, ", "); for (n=4, 100, if (Mod(n, 2)==0, d=n, d=n-3); a=a+d; print1(a, ", "))
(PARI) Vec(x^2*(2*x^5-5*x^4+2*x^3+2*x^2-2*x-1)/((x-1)^3*(x+1)) + O(x^100)) \\ Colin Barker, Jul 12 2015 and Aug 20 2015
(PARI) a(n)=if(n<3, 1, (n^2-2*n)\2+2-(n%2)) \\ Charles R Greathouse IV, Jul 17 2015
CROSSREFS
Sequence in context: A110974 A173180 A200077 * A116897 A293763 A246324
KEYWORD
nonn,easy
AUTHOR
Kival Ngaokrajang, Jul 11 2015
STATUS
approved