login
a(n) = 2*n + (-1)^n - 1.
8

%I #23 Sep 08 2022 08:45:48

%S 0,4,4,8,8,12,12,16,16,20,20,24,24,28,28,32,32,36,36,40,40,44,44,48,

%T 48,52,52,56,56,60,60,64,64,68,68,72,72,76,76,80,80,84,84,88,88,92,92,

%U 96,96,100,100,104,104,108,108,112,112,116,116,120,120,124,124,128,128,132

%N a(n) = 2*n + (-1)^n - 1.

%H Vincenzo Librandi, <a href="/A168273/b168273.txt">Table of n, a(n) for n = 1..1000</a>

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

%F From _R. J. Mathar_, Jan 05 2011: (Start)

%F G.f.: 4*x^2/( (1+x)*(1-x)^2).

%F a(n) = 2*A052928(n).

%F a(n) = A008586(floor(n/2)). (End)

%F a(n) = 2*n - 2*(n mod 2). - _Wesley Ivan Hurt_, Jun 30 2013

%F E.g.f.: (1 + (2*x - 1)*exp(2*x))*exp(-x). - _G. C. Greubel_, Jul 16 2016

%t CoefficientList[Series[4 x / ((1+x) (1-x)^2), {x, 0, 70}], x] (* _Vincenzo Librandi_, May 14 2013 *)

%t LinearRecurrence[{1,1,-1},{0,4,4},50] (* _G. C. Greubel_, Jul 16 2016 *)

%o (Magma) [2*n-1 + (-1)^n: n in [1..70]] // _Vincenzo Librandi_, May 14 2013

%o (PARI) a(n)=2*n-1+(-1)^n \\ _Charles R Greathouse IV_, Oct 07 2015

%Y Cf. A052928, A008586.

%K nonn,easy

%O 1,2

%A _Vincenzo Librandi_, Nov 22 2009