%I #46 Aug 29 2023 21:34:00
%S 1,5,16,49,148,445,1336,4009,12028,36085,108256,324769,974308,2922925,
%T 8768776,26306329,78918988,236756965,710270896,2130812689,6392438068,
%U 19177314205,57531942616,172595827849,517787483548,1553362450645
%N Expansion of g.f. (1+x-x^2)/((1-x)*(1-3*x)).
%H Vincenzo Librandi, <a href="/A052909/b052909.txt">Table of n, a(n) for n = 0..1000</a>
%H INRIA Algorithms Project, <a href="http://ecs.inria.fr/services/structure?nbr=889">Encyclopedia of Combinatorial Structures 889</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (4,-3).
%F a(n) = 3*a(n-1) + 1, with a(0)=1, a(1)=5, a(2)=16.
%F a(n) = (11*3^n - 3)/6.
%F a(n) = 4*a(n-1) - 3*a(n-2). - _Vincenzo Librandi_, Jun 22 2012
%F a(n+1) = A237930(n) + 2*A000244(n). - _Philippe Deléham_, Feb 17 2014
%F a(n) = Sum_{k=1..3} floor((3^n)/k). - _Lechoslaw Ratajczak_, Jul 31 2016
%F E.g.f.: (11*exp(3*x) - 3*exp(x) - 2)/6. - _Stefano Spezia_, Aug 28 2023
%e Ternary.......................Decimal
%e 1...................................1
%e 12..................................5
%e 121................................16
%e 1211...............................49
%e 12111.............................148
%e 121111............................445
%e 1211111..........................1336
%e 12111111.........................4009
%e 121111111.......................12028
%e 1211111111......................36085, etc. - _Philippe Deléham_, Feb 17 2014
%p spec := [S,{S=Prod(Union(Sequence(Z),Z),Sequence(Union(Z,Z,Z)))},unlabeled]: seq(combstruct[count](spec,size=n), n=0..20);
%t CoefficientList[Series[(1+x-x^2)/((1-x)*(1-3*x)),{x,0,30}],x] (* _Vincenzo Librandi_, Jun 22 2012 *)
%t Join[{1}, (11*3^Range[30] -3)/6] (* _G. C. Greubel_, Oct 15 2019 *)
%o (Magma) I:=[1, 5, 16]; [n le 3 select I[n] else 4*Self(n-1)-3*Self(n-2): n in [1..30]]; // _Vincenzo Librandi_, Jun 22 2012
%o (PARI) vector(30, n, if(n==1, 1, (11*3^(n-1) - 3)/6)) \\ _G. C. Greubel_, Oct 15 2019
%o (Sage) [1]+[(11*3^n -3)/6 for n in (1..30)] # _G. C. Greubel_, Oct 15 2019
%o (GAP) Concatenation([1], List([1..30], n-> (11*3^n - 3)/6)); # _G. C. Greubel_, Oct 15 2019
%Y Cf. A000244, A237930.
%K nonn,easy
%O 0,2
%A encyclopedia(AT)pommard.inria.fr, Jan 25 2000
%E More terms from _James A. Sellers_, Jun 08 2000