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.

Showing 1-3 of 3 results.

A121907 Expansion of g.f.: (1 + x + x^2)/(1 - 2*x - 2*x^2).

Original entry on oeis.org

1, 3, 9, 24, 66, 180, 492, 1344, 3672, 10032, 27408, 74880, 204576, 558912, 1526976, 4171776, 11397504, 31138560, 85072128, 232421376, 634987008, 1734816768, 4739607552, 12948848640, 35376912384, 96651522048, 264056868864, 721416781824, 1970947301376
Offset: 0

Views

Author

N. J. A. Sloane, Nov 20 2006

Keywords

Comments

a(n-1) is the number of compositions of n into floor((3*j-1)/2) kinds of j's for all j >= 1. The sequence of such compositions is 1,1,3,9,24,... (i.e., this sequence prepended by 1) and has g.f. 1/(1-Sum_{j>=1} floor((3*j-1)/2)*x^j). - Joerg Arndt, Jul 06 2011
a(n) is the number of length n words on 3 letters (ternary words) such that the length of any run of identical letters is <= 2. Cf. A181137 for a generalization. - Geoffrey Critzer, Sep 16 2013

References

  • A. Burstein and T. Mansour, Words restricted by 3-letter generalized multipermutation patterns, Annals. Combin., 7 (2003), 1-14.

Crossrefs

Column 3 in A265584.

Programs

  • GAP
    a:=[3,9];; for n in [3..30] do a[n]:=2*(a[n-1]+a[n-2]); od; Concatenation([1], a); # G. C. Greubel, Oct 07 2019
  • Magma
    R:=PowerSeriesRing(Integers(), 30); Coefficients(R!( (1+x+x^2)/(1-2*x-2*x^2) )); // G. C. Greubel, Oct 07 2019
    
  • Maple
    seq(coeff(series((1+x+x^2)/(1-2*x-2*x^2), x, n+1), x, n), n = 0..30); # G. C. Greubel, Oct 07 2019
  • Mathematica
    CoefficientList[Series[(1+x+x^2)/(1-2x-2x^2),{x,0,30}],x] (* or *) LinearRecurrence[{2,2},{1,3,9},30] (* Harvey P. Dale, Dec 03 2011 *)
  • PARI
    my(x='x+O('x^30)); Vec((1+x+x^2)/(1-2*x-2*x^2)) \\ G. C. Greubel, Oct 07 2019
    
  • Sage
    def A121907_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return P((1+x+x^2)/(1-2*x-2*x^2)).list()
    A121907_list(30) # G. C. Greubel, Oct 07 2019
    

Formula

a(0)=1, a(1)=3, a(2)=9; a(n) = 2*a(n-1) + 2*a(n-2) for n>=3. - Philippe Deléham, Sep 19 2009
G.f.: (1/x)*(-1 + 1/(1-Sum_{j>=1} floor((3*j-1)/2)*x^j)). - Joerg Arndt, Jul 06 2011
E.g.f.: (1/2)*exp(x)*(3*cosh(sqrt(3)*x) + sqrt(3)*sinh(sqrt(3)*x)) - 1/2. - Stefano Spezia, Oct 08 2019

A265624 Array T(n,k): The number of words of length n in an alphabet of size k which do not contain 4 consecutive letters.

Original entry on oeis.org

1, 1, 2, 1, 4, 3, 0, 8, 9, 4, 0, 14, 27, 16, 5, 0, 26, 78, 64, 25, 6, 0, 48, 228, 252, 125, 36, 7, 0, 88, 666, 996, 620, 216, 49, 8, 0, 162, 1944, 3936, 3080, 1290, 343, 64, 9, 0, 298, 5676, 15552, 15300, 7710, 2394, 512, 81, 10, 0, 548, 16572, 61452
Offset: 1

Views

Author

R. J. Mathar, Dec 10 2015

Keywords

Examples

			  1    2      3      4      5       6       7        8
  1    4      9     16     25      36      49       64
  1    8     27     64    125     216     343      512
  0   14     78    252    620    1290    2394     4088
  0   26    228    996   3080    7710   16716    32648
  0   48    666   3936  15300   46080  116718   260736
  0   88   1944  15552  76000  275400  814968  2082304
  0  162   5676  61452 377520 1645950 5690412 16629816
		

Crossrefs

Cf. A135491 (column k=2), A181137 (k=3), A188714 (k=4), A265583 (not 2 consecutive letters), A265584 (not 3 consecutive letters).

Programs

  • Maple
    A265624 := proc(n,k)
            local x;
            k*x*(1+x+x^2)/(1+(1-k)*x*(x^2+x+1)) ;
            coeftayl(%,x=0,n) ;
    end proc;
    seq(seq(A265624(d-k,k),k=1..d-1),d=2..10) ;

Formula

T(2,k) = k^2.
T(3,k) = k^3.
T(4,k) = k*(k+1)*(k^2+3*k+3).
T(5,k) = k*(k+1)*(k^3+4*k^2+6*k+2).
T(6,k) = k*(k+1)^2*(k^3+4*k^2+6*k+1).
G.f. of row k: k*x*(1+x+x^2)/(1+(1-k)*x*(x^2+x+1)).

A181140 The number of ways to color n balls in a row with 3 colors with no color runs having lengths greater than 4. This sequence is a special case of the general problem for coloring n balls in a row with p colors where each color has a given maximum run-length. In this example, the bounds are uniformly 4. It can be phrased in terms of tossing a p-faced die n times, requiring each face to have no runs longer than b.

Original entry on oeis.org

3, 9, 27, 81, 240, 714, 2124, 6318, 18792, 55896, 166260, 494532, 1470960, 4375296, 13014096, 38709768, 115140240, 342478800, 1018685808, 3030029232, 9012668160, 26807724000, 79738214400, 237177271584, 705471756288, 2098389932544
Offset: 1

Views

Author

William Sit (wyscc(AT)sci.ccny.cuny.edu), Oct 06 2010

Keywords

Comments

Generating function and recurrence for given p and uniform bound b are known.
a(n+b) = (p-1)(a(n) + ... + a(n+b-1)),
using b initial values a(1)=p, a(2)=p^2, ..., a(b)=p^(b).
The g.f. is p G/(1-(p-1)G) where G = t + t^2 + ... + t^b.

Examples

			The first nontrivial value is a(5)=240. These solutions are listed below: 11112,11113,11121,11122,11123,
11131,11132,11133,11211,11212,11213,11221,11222,11223,11231,11232,11233,11311,11312,11313,11321,11322,11323,
11331,11332,11333,12111,12112,12113,12121,12122,12123,12131,12132,12133,12211,12212,12213,12221,12222,12223,
12231,12232,12233,12311,12312,12313,12321,12322,12323,12331,12332,12333,13111,13112,13113,13121,13122,13123,
13131,13132,13133,13211,13212,13213,13221,13222,13223,13231,
13232,13233,13311,13312,13313,13321,13322,13323,13331,13332,13333,21111,21112,21113,21121,21122,21123,21131,
21132,21133,21211,21212,21213,21221,21222,21223,21231,21232,21233,21311,21312,21313,21321,21322,21323,21331,
21332,21333,22111,22112,22113,22121,22122,22123,22131,22132,22133,22211,22212,22213,22221,22223,22231,22232,
22233,22311,22312,22313,22321,22322,22323,22331,22332,22333,23111,23112,23113,23121,23122,23123,23131,23132,
23133,23211,23212,23213,23221,23222,23223,23231,23232,23233,23311,
23312,23313,23321,23322,23323,23331,23332,23333,31111,31112,31113,31121,31122,31123,31131,31132,31133,31211,
31212,31213,31221,31222,31223,31231,31232,31233,31311,31312,31313,31321,31322,31323,31331,31332,31333,32111,
32112,32113,32121,32122,32123,32131,32132,32133,32211,32212,32213,32221,32222,32223,32231,32232,32233,32311,
32312,32313,32321,32322,32323,32331,32332,32333,33111,33112,33113,33121,33122,33123,33131,33132,33133,33211,
33212,33213,33221,33222,33223,33231,33232,33233,33311,33312,33313,33321,33322,33323,33331,33332
		

Crossrefs

Programs

  • Mathematica
    (* next[p,z] computes the next member in a sequence and next[p,z] = a(n+b)= (p-1)( c(b)+ ... + c(n+b-1))
    where z is the preceding b items on the sequence starting with a(n) where b is the uniform bound on runs.
    The function sequence[p,z,n] computes the next n terms. *)
    next[p_,z_]:=(p-1) Apply[Plus,z]
    sequence[p_,z_,n_]:=Module[{y=z,seq=z, m=n, b=Length[z]}, While[m>0, seq = Join[seq,{next[p,y]}]; y = Take[seq, -b]; m-- ]; seq]
    (* sequence[3,{3,9,27,81},10] computes the next 10 terms after 3,9,27, 81. *)

Formula

For this sequence (p=3, b=4):
G.f.: 3t(t^3+t^2+t+1)/(1 - 2t(t^3+t^2+t+1));
a(n+4) = 2(a(n)+a(n+1)+a(n+2)+a(n+3)); a(1)=3, a(2)=9, a(3)=27, a(4)=81.
Showing 1-3 of 3 results.