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) = 2*a(n-1) - 2*a(n-2) + a(n-3) + 2*a(n-4) starting with a(0..3) = 0, 0, 0, 1.
2

%I #43 Jul 11 2023 08:50:50

%S 0,0,0,1,2,2,1,2,8,17,22,22,33,78,156,233,298,442,833,1546,2464,3553,

%T 5390,9230,16161,26358,40404,62713,103298,174290,285505,451154,712184,

%U 1156145,1910086,3122374,5005089,7987806,12907980,21090185,34362394,55428010

%N a(n) = 2*a(n-1) - 2*a(n-2) + a(n-3) + 2*a(n-4) starting with a(0..3) = 0, 0, 0, 1.

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

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

%F From _R. J. Mathar_, Jul 14 2011: (Start)

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

%F a(n) = (A000045(n) - A107920(n))/3. (End)

%p a:= n-> (<<0|1|0|0>, <0|0|1|0>, <0|0|0|1>, <2|1|-2|2>>^n)[1,4]:

%p seq(a(n), n=0..45); # _Alois P. Heinz_, Jul 11 2023

%t LinearRecurrence[{2,-2,1,2},{0,0,0,1},100] (* _Vincenzo Librandi_, Nov 25 2011 *)

%o (Magma) I:=[0,0,0,1]; [n le 4 select I[n] else 2*Self(n-1)-2*Self(n-2)+Self(n-3)+2*Self(n-4): n in [1..50]]; // _Vincenzo Librandi_, Nov 25 2011

%o (SageMath)

%o @CachedFunction

%o def a(n): # a = A192395

%o if (n<4): return n//3

%o else: return 2*a(n-1) - 2*a(n-2) + a(n-3) + 2*a(n-4)

%o [a(n) for n in range(51)] # _G. C. Greubel_, Jul 10 2023

%Y Cf. A000045, A107920.

%K nonn,easy

%O 0,5

%A _Paul Curtz_, Jun 29 2011