login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = Sum_{k=0..n-1} (n+k) = n(3n-1)/2 if n is even; a(n) = Sum_{k=0..n-1} (n-k) = n(n+1)/2 if n is odd.
2

%I #23 Sep 11 2022 06:21:36

%S 1,5,6,22,15,51,28,92,45,145,66,210,91,287,120,376,153,477,190,590,

%T 231,715,276,852,325,1001,378,1162,435,1335,496,1520,561,1717,630,

%U 1926,703,2147,780,2380,861,2625,946,2882,1035,3151,1128,3432,1225,3725,1326

%N a(n) = Sum_{k=0..n-1} (n+k) = n(3n-1)/2 if n is even; a(n) = Sum_{k=0..n-1} (n-k) = n(n+1)/2 if n is odd.

%H Colin Barker, <a href="/A110344/b110344.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,0,-3,0,1).

%F From _Emeric Deutsch_, Aug 01 2005: (Start)

%F a(2n+1) = A000217(2n+1) = (n+1)(2n+1) (triangular numbers with odd index).

%F a(2n) = A000326(2n) = A049452(n) = n(6n-1) (pentagonal numbers with even index).

%F (End)

%F a(n) = n*( 2*n + (n-1)*(-1)^n )/2. - _Luce ETIENNE_, Jul 08 2014

%F From _Colin Barker_, Feb 17 2015: (Start)

%F a(n) = 3*a(n-2)-3*a(n-4)+a(n-6).

%F G.f.: -x*(7*x^3+3*x^2+5*x+1) / ((x-1)^3*(x+1)^3). (End)

%F Sum_{n>=1} 1/a(n) = 4*log(2) + 3*log(3)/2 - sqrt(3)*Pi/2. - _Amiram Eldar_, Sep 11 2022

%e a(3) = 3 + 2 +1 = 6.

%e a(6) = 6 + 7 + 8 + 9 + 10 + 11 = 51.

%p 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_

%t a[n_] := n*(2*n + (n - 1)*(-1)^n)/2; Array[a, 50] (* _Amiram Eldar_, Sep 11 2022 *)

%o (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

%Y Cf. A000217, A000326, A049452.

%K nonn,easy

%O 1,2

%A _Amarnath Murthy_, Jul 20 2005

%E More terms from _Emeric Deutsch_, Aug 01 2005