cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A052942 Expansion of 1/((1+x)*(1-2*x+2*x^2-2*x^3)).

Original entry on oeis.org

1, 1, 1, 1, 3, 5, 7, 9, 15, 25, 39, 57, 87, 137, 215, 329, 503, 777, 1207, 1865, 2871, 4425, 6839, 10569, 16311, 25161, 38839, 59977, 92599, 142921, 220599, 340553, 525751, 811593, 1252791, 1933897, 2985399, 4608585, 7114167, 10981961
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

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
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

Crossrefs

Column k=3 of A143453.

Programs

  • 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
  • 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
    
  • Maple
    spec := [S,{S=Sequence(Union(Z,Prod(Union(Z,Z),Z,Z,Z)))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20);
    seq(add(binomial(n-3*k,k)*2^k, k=0..floor(n/3)), n=0..39); # Zerinvary Lajos, Apr 03 2007
    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
    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)):
    seq(simplify(a(n)),n=0..39); # Peter Luschny, Mar 09 2015
  • Mathematica
    CoefficientList[Series[1/(1-x-2*x^4), {x,0,40}], x] (* Vincenzo Librandi, Mar 10 2015 *)
    LinearRecurrence[{1,0,0,2},{1,1,1,1},50] (* Harvey P. Dale, Aug 17 2024 *)
  • PARI
    Vec( 1/(1-x-2*x^4) + O(x^66)) \\ Joerg Arndt, Aug 28 2013
    
  • Sage
    (1/(1-x-2*x^4)).series(x, 40).coefficients(x, sparse=False) # G. C. Greubel, Jun 12 2019
    

Formula

G.f.: 1/(1-x-2*x^4).
a(n) = a(n-1) + 2*a(n-4), with a(1)=1, a(0)=1, a(2)=1, a(3)=1.
a(n) = Sum_{alpha=RootOf(-1+_Z+2*_Z^4)} (1/539)*(27 + 72*alpha^3 + 96*alpha^2 + 128*alpha)*alpha^(-1-n)).
a(n) = Sum_{k=0..floor(n/3)} A128099(n-2*k, k). - Johannes W. Meijer, Aug 28 2013
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

Extensions

More terms from James Sellers, Jun 06 2000