login
a(n+1) = 3*a(n) - n.
5

%I #15 Sep 09 2017 03:22:29

%S 1,2,4,9,23,64,186,551,1645,4926,14768,44293,132867,398588,1195750,

%T 3587235,10761689,32285050,96855132,290565377,871696111,2615088312,

%U 7845264914,23535794719,70607384133,211822152374,635466457096

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

%H G. C. Greubel, <a href="/A164039/b164039.txt">Table of n, a(n) for n = 0..1000</a>

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

%F a(0) = 1; a(n+1) = 3*a(n) - n.

%F a(n) = (3^n + 2*n + 3)/4.

%F From _R. J. Mathar_, Aug 09 2009: (Start)

%F a(n) = 5*a(n-1)-7*a(n-2)+3*a(n-3).

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

%F E.g.f.: (1/4)*((2*x + 3)*exp(x) + exp(3*x)). - _G. C. Greubel_, Sep 08 2017

%t Transpose[NestList[Flatten[{Rest[#],ListCorrelate[#,{3,-7,5}]}]&, {1,2,4},30]][[1]] (* _Harvey P. Dale_, Mar 24 2011 *)

%t Table[(3^n + 2*n + 3)/4, {n,0,50}] (* _G. C. Greubel_, Sep 08 2017 *)

%o (PARI) x='x+O('x^50); Vec((1-3*x+x^2)/((1-3*x)*(1-x)^2)) \\ _G. C. Greubel_, Sep 08 2017

%K nonn,easy

%O 0,2

%A _Rolf Pleisch_, Aug 08 2009