OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
From Emeric Deutsch, Aug 01 2005: (Start)
a(2n+1) = A000217(2n+1) = (n+1)(2n+1) (triangular numbers with odd index).
(End)
a(n) = n*( 2*n + (n-1)*(-1)^n )/2. - Luce ETIENNE, Jul 08 2014
From Colin Barker, Feb 17 2015: (Start)
a(n) = 3*a(n-2)-3*a(n-4)+a(n-6).
G.f.: -x*(7*x^3+3*x^2+5*x+1) / ((x-1)^3*(x+1)^3). (End)
Sum_{n>=1} 1/a(n) = 4*log(2) + 3*log(3)/2 - sqrt(3)*Pi/2. - Amiram Eldar, Sep 11 2022
EXAMPLE
a(3) = 3 + 2 +1 = 6.
a(6) = 6 + 7 + 8 + 9 + 10 + 11 = 51.
MAPLE
a:=proc(n) if n mod 2=0 then n*(3*n-1)/2 else n*(n+1)/2 fi end: seq(a(n), n=1..60); # Emeric Deutsch
MATHEMATICA
a[n_] := n*(2*n + (n - 1)*(-1)^n)/2; Array[a, 50] (* Amiram Eldar, Sep 11 2022 *)
PROG
(PARI) Vec(-x*(7*x^3+3*x^2+5*x+1)/((x-1)^3*(x+1)^3) + O(x^100)) \\ Colin Barker, Feb 17 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy, Jul 20 2005
EXTENSIONS
More terms from Emeric Deutsch, Aug 01 2005
STATUS
approved