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

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

%S 3,3,7,7,11,11,15,15,19,19,23,23,27,27,31,31,35,35,39,39,43,43,47,47,

%T 51,51,55,55,59,59,63,63,67,67,71,71,75,75,79,79,83,83,87,87,91,91,95,

%U 95,99,99,103,103,107,107,111,111,115,115,119,119,123,123,127,127,131,131

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

%H Vincenzo Librandi, <a href="/A168269/b168269.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 G.f.: x*(3 + x^2)/( (1+x)*(x-1)^2 ). - _R. J. Mathar_, Jan 05 2011

%F a(n) = a(n-1) +a(n-2) -a(n-3). - _Vincenzo Librandi_, Sep 16 2013

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

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

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

%o (Magma) [2*n-(-1)^n: n in [1..70]]; // _Vincenzo Librandi_, Sep 16 2013

%o (PARI) a(n)=2*n-(-1)^n \\ _Charles R Greathouse IV_, Jul 16 2016

%Y Cf. A004767.

%K nonn,easy

%O 1,1

%A _Vincenzo Librandi_, Nov 22 2009

%E New definition by _R. J. Mathar_, Jan 05 2011