login
a(n) = 2*(a(n-1) + a(n-3)) - a(n-4), with a(0) = 1, a(1) = 2, a(2) = 5 and a(3) = 12.
1

%I #28 Sep 08 2022 08:46:23

%S 1,2,5,12,27,62,143,328,753,1730,3973,9124,20955,48126,110527,253840,

%T 582977,1338882,3074917,7061948,16218683,37248318,85545615,196466648,

%U 451211249,1036265410,2379918501,5465792852,12552905275,28829382142

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

%C The growth factor for large n (i.e., a(n)/a(n-1)) is (1 + sqrt(3) + sqrt(2*sqrt(3))) = A319129.

%H Colin Barker, <a href="/A319172/b319172.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,0,2,-1).

%F Lim_{n -> inf) a(n)/a(n-1) = (1 + sqrt(3) + sqrt(2*sqrt(3)))/2 = A319129.

%F G.f.: (1 + x^2) / (1 - 2*x - 2*x^3 + x^4). - _Colin Barker_, Sep 13 2018

%p f:= gfun:-rectoproc({a(n) = 2*(a(n-1)+a(n-3))-a(n-4), a(0) = 1, a(1) = 2, a(2) = 5, a(3) = 12},a(n),remember):

%p map(f, [$0..40]); # _Robert Israel_, Sep 12 2018

%t LinearRecurrence[{2, 0, 2, -1}, {1, 2, 5, 12}, 30] (* _Vincenzo Librandi_, Sep 29 2018 *)

%t CoefficientList[Series[(1 + x^2) / (1 - 2*x - 2*x^3 + x^4), {x, 0, 30}], x] (* _Stefano Spezia_, Sep 29 2018 *)

%o (GAP) a:=[1,2,5,12];; for n in [5..30] do a[n]:=2*(a[n-1]+a[n-3])-a[n-4]; od; a; # _Muniru A Asiru_, Sep 12 2018

%o (PARI) Vec((1 + x^2) / (1 - 2*x - 2*x^3 + x^4) + O(x^40)) \\ _Colin Barker_, Sep 13 2018

%o (Magma) I:=[1,2,5,12]; [n le 4 select I[n] else 2*(Self(n-1) + Self(n-3)) - Self(n-4): n in [1..30]]; // _Vincenzo Librandi_, Sep 29 2018

%Y Cf. A319129.

%K nonn,easy

%O 0,2

%A _A.H.M. Smeets_, Sep 12 2018