login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = n(n+1) if n == 0 or 1 (mod 4), otherwise a(n) = n(n+1)/2.
3

%I #48 Aug 12 2022 09:22:42

%S 0,2,3,6,20,30,21,28,72,90,55,66,156,182,105,120,272,306,171,190,420,

%T 462,253,276,600,650,351,378,812,870,465,496,1056,1122,595,630,1332,

%U 1406,741,780,1640,1722,903,946,1980,2070,1081,1128

%N a(n) = n(n+1) if n == 0 or 1 (mod 4), otherwise a(n) = n(n+1)/2.

%H Vincenzo Librandi, <a href="/A227316/b227316.txt">Table of n, a(n) for n = 0..1000</a>

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

%F a(n) = A130658(n+2)*A000217(n), a(-n-1) = A130658(n)*A000217(n).

%F a(2n) = A169642(n), a(2n+1) = 2*(2*n+1)*A026741(n+1).

%F a(n) = A176743(n-2)*A176743(n-1).

%F a(n) = A177002(n+2)*A064038(n+1).

%F a(n) = 3*a(n-1) -6*a(n-2) +10*a(n-3) -12*a(n-4) +12*a(n-5) -10*(n-6) +6*(n-7) -3*a(n-8) +a(n-9) = 3*a(n-4) -3*a(n-8) +a(n-12).

%F G.f.: x*(2-3*x+9*x^2+3*x^5+x^6)/((1-x)^3*(1+x^2)^3). - _Bruno Berselli_, Jul 10 2013

%F a(n) = (3+(-1)^floor(n/2))*n*(n+1)/4. - _Bruno Berselli_, Jul 10 2013

%F Sum_{n>=1} 1/a(n) = 1 + log(2)/2. - _Amiram Eldar_, Aug 12 2022

%e a(0) = 2*0 = 0, a(1) = 2*1 = 2, a(2) = 1*3 = 3, a(3) = 1*6 = 6, a(4) = 2*10 = 20.

%t a[n_] := n*(n+1)/4*GCD[n-1, 4]*GCD[n, 4]; Table[a[n], {n, 0, 50}] (* _Jean-François Alcover_, Jul 10 2013 *)

%t Table[If[Mod[n,4]<2,n(n+1),(n(n+1))/2],{n,0,50}] (* or *) LinearRecurrence[ {3,-6,10,-12,12,-10,6,-3,1},{0,2,3,6,20,30,21,28,72},50] (* _Harvey P. Dale_, Aug 26 2016 *)

%o (Magma) [(3+(-1)^Floor(n/2))*n*(n+1)/4: n in [0..50]]; // _Bruno Berselli_, Jul 10 2013

%Y Cf. A000217, A002378, A130658, A169642 (first bisection), A176743, A109043, A227380.

%K nonn,easy

%O 0,2

%A _Paul Curtz_, Jul 06 2013