%I #47 Sep 08 2022 08:44:59
%S 1,1,1,1,3,5,7,9,15,25,39,57,87,137,215,329,503,777,1207,1865,2871,
%T 4425,6839,10569,16311,25161,38839,59977,92599,142921,220599,340553,
%U 525751,811593,1252791,1933897,2985399,4608585,7114167,10981961
%N Expansion of 1/((1+x)*(1-2*x+2*x^2-2*x^3)).
%C The compositions of n in which each natural number is colored by one of p different colors are called p-colored compositions of n. For n >= 4, 3*a(n-4) equals the number of 3-colored compositions of n with all parts >= 4, such that no adjacent parts have the same color. - _Milan Janjic_, Nov 27 2011
%C a(n+3) equals the number of ternary words of length n having at least 3 zeros between every two successive nonzero letters. - _Milan Janjic_, Mar 09 2015
%H G. C. Greubel, <a href="/A052942/b052942.txt">Table of n, a(n) for n = 0..1000</a>
%H INRIA Algorithms Project, <a href="http://ecs.inria.fr/services/structure?nbr=933">Encyclopedia of Combinatorial Structures 933</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,2).
%F G.f.: 1/(1-x-2*x^4).
%F a(n) = a(n-1) + 2*a(n-4), with a(1)=1, a(0)=1, a(2)=1, a(3)=1.
%F a(n) = Sum_{alpha=RootOf(-1+_Z+2*_Z^4)} (1/539)*(27 + 72*alpha^3 + 96*alpha^2 + 128*alpha)*alpha^(-1-n)).
%F a(n) = Sum_{k=0..floor(n/3)} A128099(n-2*k, k). - _Johannes W. Meijer_, Aug 28 2013
%F a(n) = hypergeom([(1-n)/4,(2-n)/4,(3-n)/4,-n/4],[(1-n)/3,(2-n)/3,-n/3],-512/27)) for n>=9. - _Peter Luschny_, Mar 09 2015
%p spec := [S,{S=Sequence(Union(Z,Prod(Union(Z,Z),Z,Z,Z)))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20);
%p seq(add(binomial(n-3*k,k)*2^k, k=0..floor(n/3)), n=0..39); # _Zerinvary Lajos_, Apr 03 2007
%p with(combstruct): SeqSeqSeqL := [T, {T=Sequence(S), S=Sequence(U, card >= 1), U=Sequence(Z, card >3)}, unlabeled]: seq(count(SeqSeqSeqL, size=j+4), j=0..39); # _Zerinvary Lajos_, Apr 04 2009
%p a := n -> `if`(n<9, [1, 1, 1, 1, 3, 5, 7, 9, 15][n+1], hypergeom([(1-n)/4,(2-n)/4,(3-n)/4,-n/4], [(1-n)/3,(2-n)/3,-n/3], -512/27)):
%p seq(simplify(a(n)),n=0..39); # _Peter Luschny_, Mar 09 2015
%t CoefficientList[Series[1/(1-x-2*x^4), {x,0,40}], x] (* _Vincenzo Librandi_, Mar 10 2015 *)
%o (PARI) Vec( 1/(1-x-2*x^4) +O(x^66)) \\ _Joerg Arndt_, Aug 28 2013
%o (Magma) I:=[1,1,1,1]; [n le 4 select I[n] else Self(n-1)+2*Self(n-4): n in [1..40]]; // _Vincenzo Librandi_, Mar 10 2015
%o (Sage) (1/(1-x-2*x^4)).series(x, 40).coefficients(x, sparse=False) # _G. C. Greubel_, Jun 12 2019
%o (GAP) a:=[1,1,1,1];; for n in [5..40] do a[n]:=a[n-1]+2*a[n-4]; od; a; # _G. C. Greubel_, Jun 12 2019
%Y Column k=3 of A143453.
%K easy,nonn
%O 0,5
%A encyclopedia(AT)pommard.inria.fr, Jan 25 2000
%E More terms from _James A. Sellers_, Jun 06 2000
|