login
a(n) = 2*a(n-1) - a(n-2) + 2*a(n-3) - a(n-4) + a(n-5), n > 5.
2

%I #21 Sep 08 2022 08:45:39

%S 1,1,1,1,2,4,8,16,31,60,117,228,444,865,1685,3282,6393,12453,24257,

%T 47250,92038,179280,349218,680239,1325032,2581019,5027546,9793116,

%U 19075931,37157851,72379476,140987393,274628197,534946033,1042017030,2029736504,3953707240

%N a(n) = 2*a(n-1) - a(n-2) + 2*a(n-3) - a(n-4) + a(n-5), n > 5.

%C Conjecture: this is the inverse Motzkin transform of A054393.

%H G. C. Greubel, <a href="/A152718/b152718.txt">Table of n, a(n) for n = 0..3435</a>

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

%F a(n)=1, n < 4. a(4)=2, a(5)=4. a(n) = 2*a(n-1) - a(n-2) + 2a(n-3) - a(n-4) + a(n-5), n > 5.

%F G.f.: 1 + x*(-1 + x + x^3)/(-1 + 2*x - x^2 + 2*x^3 - x^4 + x^5). - _R. J. Mathar_, May 26 2016

%p a:= n-> `if`(n=0, 1, (<<0|1|0|0|0>, <0|0|1|0|0>, <0|0|0|1|0>,

%p <0|0|0|0|1>, <1|-1|2|-1|2>>^n. <<0, 1, 1, 1, 2>>)[1$2]):

%p seq(a(n), n=0..40); # _Alois P. Heinz_, Nov 08 2016

%t Join[{1}, LinearRecurrence[{2, -1, 2, -1, 1}, {1, 1, 1, 2, 4}, 50]] (* _G. C. Greubel_, Sep 01 2018 *)

%o (PARI) a(n) = {if (n==0, return(1)); if (n==1, return(1)); if (n==2, return(1)); if (n==3, return(1)); if (n==4, return(2)); if (n==5, return(4)); return (2*a(n-1)-a(n-2)+2*a(n-3)-a(n-4)+a(n-5));} \\ _Michel Marcus_, Jul 23 2013

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

%o (Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!(1 + x*(-1+x+x^3)/(-1+2*x-x^2+2*x^3-x^4+x^5))); // _G. C. Greubel_, Sep 01 2018

%K easy,nonn

%O 0,5

%A _R. J. Mathar_, Dec 11 2008