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-6 of 6 results.

A201641 Triangle read by rows, T(n,k) for 0<=k<=n, generalizes the colored Motzkin paths of A129400.

Original entry on oeis.org

1, 2, 1, 8, 4, 1, 32, 20, 6, 1, 144, 96, 36, 8, 1, 672, 480, 200, 56, 10, 1, 3264, 2432, 1104, 352, 80, 12, 1, 16256, 12544, 6048, 2128, 560, 108, 14, 1, 82688, 65536, 33152, 12544, 3680, 832, 140, 16, 1, 427520, 346368, 182016, 72960, 23232, 5904, 1176, 176, 18, 1
Offset: 0

Views

Author

Peter Luschny, Sep 20 2012

Keywords

Examples

			Triangle begins as:
[0] [1]
[1] [2, 1]
[2] [8, 4, 1]
[3] [32, 20, 6, 1]
[4] [144, 96, 36, 8, 1]
[5] [672, 480, 200, 56, 10, 1]
[6] [3264, 2432, 1104, 352, 80, 12, 1]
[7] [16256, 12544, 6048, 2128, 560, 108, 14, 1]
[8] [82688, 65536, 33152, 12544, 3680, 832, 140, 16, 1]
		

Crossrefs

Cf. A129400.

Programs

  • Magma
    [[k eq n select 1 else 2^(n-k)*((k+1)/(n+1))*(&+[(-1)^j* Binomial(n+1,j)*Binomial(2*n-k-3*j, n-k-3*j): j in [0..Floor((n-k)/3)]]) :k in [0..n]]: n in [0..10]]; // G. C. Greubel, Apr 05 2019
  • Maple
    T := (n, k) -> 2^n*add(binomial(n,j)*(binomial(n-j,j+k) - binomial(n-j, j+k+2)) *2^(-k), j=0..n); seq(seq(T(n,k), k=0..n), n=0..8); # Peter Luschny, Dec 31 2019
  • Mathematica
    T[n_, k_]:= If[k==n, 1, 2^(n-k)*((k+1)/(n+1))*Sum[(-1)^j*Binomial[n+1,j]* Binomial[2*n-k-3*j, n-k-3*j], {j, 0, Floor[(n-k)/3]}]];
    Table[T[n, k], {n, 0, 10}, {k, 0, n}] (* G. C. Greubel, Apr 04 2019 *)
  • Maxima
    T(n,k):=(k+1)/(n+1)*2^(n-k)*sum((-1)^j*binomial(n+1,j)*binomial(2*n-k-3*j,n-k-3*j),j,0,floor((n-k)/3)); /* Vladimir Kruchinin, Apr 06 2019 */
    
  • PARI
    {T(n,k) = if(k==n, 1, 2^(n-k)*((k+1)/(n+1))*sum(j=0, floor((n-k)/3), (-1)^j*binomial(n+1,j)*binomial(2*n-k-3*j, n-k-3*j)))};
    for(n=0,10, for(k=0,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Apr 04 2019
    
  • Sage
    def A201641_triangle(dim):
        M = matrix(ZZ,dim,dim)
        for n in range(dim): M[n,n] = 1
        for n in (1..dim-1):
            for k in (0..n-1):
                M[n,k] = M[n-1,k-1]+2*M[n-1,k]+4*M[n-1,k+1]
        return M
    A201641_triangle(9)
    
  • Sage
    @CachedFunction
    def T(n, k):
        if k==n: return 1
        else: return 2^(n-k)*((k+1)/(n+1))*sum((-1)^j*binomial(n+1,j)* binomial(2*n-k-3*j, n-k-3*j) for j in (0..floor((n-k)/3)))
    [[T(n,k) for k in (0..n)] for n in (0..10)] # G. C. Greubel, Apr 05 2019
    

Formula

Recurrence: T(0,0)=1, T(0,k)=0 for k>0 and for n>=1 T(n,k) = T(n-1,k-1) + 2*T(n-1,k) + 4*T(n-1,k+1).
T(n,k) = ((k+1)/(n+1))*2^(n-k)*Sum_{j=0..floor((n-k)/3)} (-1)^j*C(n+1,j) *C(2*n-k-3*j,n-k-3*j). - Vladimir Kruchinin, Apr 06 2019
T(n,k) = 2^n*Sum_{j=0..n} C(n,j)*(C(n-j, j+k) - C(n-j, j+k+2))*2^(-k). - Peter Luschny, Dec 31 2019

A005572 Number of walks on cubic lattice starting and finishing on the xy plane and never going below it.

Original entry on oeis.org

1, 4, 17, 76, 354, 1704, 8421, 42508, 218318, 1137400, 5996938, 31940792, 171605956, 928931280, 5061593709, 27739833228, 152809506582, 845646470616, 4699126915422, 26209721959656, 146681521121244, 823429928805936
Offset: 0

Views

Author

Keywords

Comments

Also number of paths from (0,0) to (n,0) in an n X n grid using only Northeast, East and Southeast steps and the East steps come in four colors. - Emeric Deutsch, Nov 03 2002
Number of skew Dyck paths of semilength n+1 with the left steps coming in two colors. - David Scambler, Jun 21 2013
Number of 2-colored Schroeder paths from (0,0) to (2n+2,0) with no level steps H=(2,0) at an even level. There are two ways to color an H-step at an odd level. Example: a(1)=4 because we have UUDD, UHD (2 choices) and UDUD. - José Luis Ramírez Ramírez, Apr 27 2015

Examples

			a(3) = 76 = sum of top row terms of M^3; i.e., (37 + 29 + 9 + 1).
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Binomial transform of A002212. Sequence shifted right twice is A025228.

Programs

  • Maple
    a := n -> simplify(2^n*hypergeom([3/2, -n], [3], -2)):
    seq(a(n), n=0..21); # Peter Luschny, Feb 03 2015
    a := n -> simplify(GegenbauerC(n, -n-1, -2))/(n+1):
    seq(a(n), n=0..21); # Peter Luschny, May 09 2016
  • Mathematica
    RecurrenceTable[{a[0]==1,a[1]==4,a[n]==((2n+1)a[n-1]-3(n-1)a[n-2]) 4/(n+2)}, a[n],{n,30}] (* Harvey P. Dale, Oct 04 2011 *)
    a[n_]:=If[n==0,1,Coefficient[(1+4x+x^2)^(n+1),x^n]/(n+1)]
    Table[a[n],{n,0,40}] (* Emanuele Munarini, Apr 06 2012 *)
  • Maxima
    a(n):=coeff(expand((1+4*x+x^2)^(n+1)),x^n)/(n+1); makelist(a(n),n,0,12); /* Emanuele Munarini, Apr 06 2012 */
    
  • PARI
    a(n)=polcoeff((1-4*x-sqrt(1-8*x+12*x^2+x^3*O(x^n)))/2,n+2)
    
  • PARI
    { A005572(n) = sum(k=0,n\2, binomial(n,2*k) * binomial(2*k,k) * 4^(n-2*k) / (k+1) ) } /* Max Alekseyev, Feb 02 2015 */
    
  • PARI
    {a(n)=sum(k=0,n, binomial(n,k) * 2^(n-k) * binomial(2*k+2, k)/(k+1) )}
    for(n=0,30,print1(a(n),", ")) \\ Paul D. Hanna, Feb 02 2015
    
  • Sage
    def A005572(n):
        A108198 = lambda n,k: (-1)^k*catalan_number(k+1)*rising_factorial(-n,k)/factorial(k)
        return sum(A108198(n,k)*2^(n-k) for k in (0..n))
    [A005572(n) for n in range(22)] # Peter Luschny, Feb 05 2015

Formula

Generating function A(x) satisfies 1 + (xA)^2 = A - 4xA.
a(0) = 1 and, for n > 0, a(n) = 4a(n-1) + Sum_{i=1..n-1} a(i-1)*a(n-i-1). - John W. Layman, Jan 07 2000
G.f.: (1 - 4*x - sqrt(1 - 8*x + 12*x^2))/(2*x^2).
D-finite with recurrence: a(n) = ((2*n+1)*a(n-1) - 3*(n-1)*a(n-2))*4/(n+2), n > 0.
a(m+n) = Sum_{k>=0} A052179(m, k)*A052179(n, k) = A052179(m+n, 0). - Philippe Deléham, Sep 15 2005
a(n) = 4*a(n-1) + A052177(n-1) = A052179(n, 0) = 6*A005573(n)-A005573(n-1) = Sum_{j=0..floor(n/2)} 4^(n-2*j)*C(n, 2*j)*C(2*j, j)/(j+1). - Henry Bottomley, Aug 23 2001
a(n) = Sum_{k=0..n} A097610(n,k)*4^k. - Philippe Deléham, Dec 03 2009
Let A(x) be the g.f., then B(x) = 1 + x*A(x) = 1 + 1*x + 4*x^2 + 17*x^3 + ... = 1/(1-z/(1-z/(1-z/(...)))) where z=x/(1-2*x) (continued fraction); more generally B(x) = C(x/(1-2*x)) where C(x) is the g.f. for the Catalan numbers (A000108). - Joerg Arndt, Mar 18 2011
From Gary W. Adamson, Jul 21 2011: (Start)
a(n) = sum of top row terms of M^n, M = an infinite square production matrix as follows:
3, 1, 0, 0, ...
1, 3, 1, 0, ...
1, 1, 3, 1, ...
1, 1, 1, 3, ...
... (End)
a(n) ~ 3*6^(n+1/2)/(n^(3/2)*sqrt(Pi)). - Vaclav Kotesovec, Oct 05 2012
a(n) = Sum_{k=0..floor(n/2)} binomial(n,2*k) * binomial(2k,k) * 4^(n-2k) / (k+1). - Max Alekseyev, Feb 02 2015
From Paul D. Hanna, Feb 02 2015: (Start)
a(n) = Sum_{k=0..n} binomial(n,k) * 2^(n-k) * binomial(2*k+2, k)/(k+1).
a(n) = Sum_{k=0..n} binomial(n,k) * 2^(n-k) * A000108(k+1).
a(n) = [x^n] (1 + 4*x + x^2)^(n+1) / (n+1).
G.f.: (1/x) * Series_Reversion( x/(1 + 4*x + x^2) ). (End)
a(n) = 2^n*hypergeom([3/2, -n], [3], -2). - Peter Luschny, Feb 03 2015
a(n) = 4^n*hypergeom([-n/2, (1-n)/2], [2], 1/4). - Robert Israel, Feb 04 2015
a(n) = Sum_{k=0..n} A108198(n,k)*2^(n-k). - Peter Luschny, Feb 05 2015
a(n) = 2*(12^(n/2))*(n!/(n+2)!)*GegenbauerC(n, 3/2,2/sqrt(3)), where GegenbauerC are Gegenbauer polynomials in Maple notation. This is a consequence of Robert Israel's formula. - Karol A. Penson, Feb 20 2015
a(n) = (2^(n+1)*3^((n+1)/2)*P(n+1,1,2/sqrt(3)))/((n+1)*(n+2)) where P(n,u,x) are the associated Legendre polynomials of the first kind. - Peter Luschny, Feb 24 2015
a(n) = -6^(n+1)*sqrt(3)*Integral{t=0..Pi}(cos(t)*(2+cos(t))^(-n-2))/(Pi*(n+2)). - Peter Luschny, Feb 24 2015
From Karol A. Penson and Wojciech Mlotkowski, Mar 16 2015: (Start)
Integral representation as the n-th moment of a positive function defined on a segment x=[2, 6]. This function is the Wigner's semicircle distribution shifted to the right by 4. This representation is unique. In Maple notation,
a(n) = int(x^n*sqrt(4-(x-4)^2)/(2*Pi), x=2..6),
a(n) = 2*6^n*Pochhammer(3/2, n)*hypergeom([-n, 3/2], [-n-1/2], 1/3)/(n+2)!
(End)
a(n) = GegenbauerC(n, -n-1, -2)/(n+1). - Peter Luschny, May 09 2016
E.g.f.: exp(4*x) * BesselI(1,2*x) / x. - Ilya Gutkovskiy, Jun 01 2020
From Peter Bala, Aug 18 2021: (Start)
G.f. A(x) = 1/(1 - 2*x)*c(x/(1 - 2*x))^2, where c(x) = (1 - sqrt(1 - 4*x))/(2*x) is the g.f. of the Catalan numbers A000108. Cf. A129400.
Conjecture: a(n) is even except for n of the form 2*(2^k - 1). [added Feb 03: the conjecture follows from the formula a(n) = Sum_{k = 0..n} 2^(n-k)*binomial(n, k)*Catalan(k+1) given above.] (End)
From Peter Bala, Feb 03 2024: (Start)
G.f.: 1/(1 - 2*x) * c(x/(1 - 2*x))^2 = 1/(1 - 6*x) * c(-x/(1 - 6*x))^2, where c(x) = (1 - sqrt(1 - 4*x))/(2*x) is the g.f. of the Catalan numbers A000108.
a(n) = 6^n * Sum_{k = 0..n} (-6)^(-k)*binomial(n, k)*Catalan(k+1).
a(n) = 6^n * hypergeom([-n, 3/2], [3], 2/3). (End)

Extensions

Additional comments from Michael Somos, Jun 10 2000

A330799 Evaluation of the Motzkin polynomials at 1/2 and normalized with 2^n.

Original entry on oeis.org

1, 3, 13, 59, 285, 1419, 7245, 37659, 198589, 1059371, 5705517, 30976571, 169338781, 931239243, 5147825421, 28587660123, 159406327677, 892113040491, 5009160335085, 28210229053563, 159304938535773, 901845743050635, 5117144607546573, 29096321095698843, 165765778648482621
Offset: 0

Views

Author

Peter Luschny, Jan 01 2020

Keywords

Crossrefs

Programs

  • Magma
    m:=30;
    R:=PowerSeriesRing(Rationals(), m+2);
    A330799:= func< n | Coefficient(R!( 2/(1-4*x+Sqrt((1-6*x)*(1+2*x))) ), n) >;
    [A330799(n): n in [0..m]]; // G. C. Greubel, Sep 14 2023
  • Maple
    a := proc(n) option remember; if n < 3 then return [1, 3, 13][n+1] fi;
    (-84*(n - 2)*a(n-3) - 2*(8*n + 5)*a(n-2) + (11*n + 5)*a(n-1))/(n + 1) end:
    seq(a(n), n=0..24);
    # Alternative:
    gf := 2/(1 - 4*x + sqrt((1 - 6*x)*(2*x + 1))):
    ser := series(gf, x, 30): seq(coeff(ser,x,n), n=0..24);
    # Or:
    series((x^2+x)/(7*x^2+4*x+1), x, 30): gfun:-seriestoseries(%, 'revogf'):
    convert(%, polynom) / x: seq(coeff(%, x, n), n=0..24);
  • Mathematica
    With[{C = Binomial}, A064189[n_, k_] := Sum[C[n, j]* (C[n-j, j+k] - C[n-j, j+k+2]), {j, 0, n}]];
    a[n_] := 2^n*Sum[A064189[n, k]/2^k, {k, 0, n}];
    Table[a[n], {n, 0, 24}] (* Jean-François Alcover, Sep 25 2022 *)
    (* Second program *)
    A330799[n_]:= Coefficient[Series[2/(1-4*x+Sqrt[(1-6*x)*(1+2*x)]), {x, 0,50}], x, n]; Table[A330799[n], {n,0,30}] (* G. C. Greubel, Sep 14 2023 *)
  • SageMath
    R. = PowerSeriesRing(QQ)
    f = (x^2 + x)/(7*x^2 + 4*x+1)
    f.reverse().shift(-1).list()
    

Formula

a(n) = Sum_{k=0..n} A201641(n,k).
a(n) = 2^n*Sum_{k=0..n} A064189(n,k)/2^k.
a(n) = (-84*(n - 2)*a(n-3) - 2*(8*n + 5)*a(n-2) + (11*n + 5)*a(n-1))/(n + 1).
a(n) = [x^n] 2/(1 - 4*x + sqrt((1 - 6*x)*(2*x + 1))).
a(n) = [x^n] reverse((x^2 + x)/(7*x^2 + 4*x+1))/x.

A330800 Evaluation of the Motzkin polynomials at -1/2 and normalized with (-2)^n.

Original entry on oeis.org

1, -1, 5, -17, 77, -345, 1653, -8097, 40733, -208553, 1084421, -5708785, 30370861, -163019641, 881790357, -4801746753, 26302052925, -144825094473, 801155664933, -4450426297233, 24815385947469, -138842668857369, 779247587235765, -4385948395419873, 24750623835149661
Offset: 0

Views

Author

Peter Luschny, Jan 01 2020

Keywords

Crossrefs

Programs

  • Magma
    I:=[1,-1,5]; [n le 3 select I[n] else ((6-n)*Self(n-1) + 6*(4*n-9)*Self(n-2) -36*(n-3)*Self(n-3))/n: n in [1..30]]; // G. C. Greubel, Sep 13 2023
  • Maple
    a := proc(n) option remember; if n < 3 then return [1, -1, 5][n+1] fi;
    (-36*(n - 2)*a(n-3) + 6*(4*n - 5)*a(n-2) - (n - 5)*a(n-1))/(n + 1) end:
    seq(a(n), n=0..24);
    # Alternative:
    gf := 2/(sqrt(4*x - 12*x^2 + 1) + 1):
    ser := series(gf, x, 30): seq(coeff(ser,x,n), n=0..24);
    # Or:
    series((x^2+x)/(3*x^2+1), x, 30): gfun:-seriestoseries(%, 'revogf'):
    convert(%, polynom) / x: seq(coeff(%, x, n), n=0..24);
  • Mathematica
    A330800[n_]:= Coefficient[Series[2/(Sqrt[4*x-12*x^2+1] +1), {x,0,50}], x, n]; Table[A330800[n], {n, 0, 30}] (* G. C. Greubel, Sep 13 2023 *)
  • SageMath
    R. = PowerSeriesRing(QQ)
    f = (x^2 + x)/(3*x^2 + 1)
    f.reverse().shift(-1).list()
    

Formula

a(n) = Sum_{k=0..n} (-1)^(n-k)*A201641(n,k).
a(n) = (-2)^n*Sum_{k=0..n} A064189(n,k)/(-2)^k.
a(n) = (-36*(n-2)*a(n-3) + 6*(4*n-5)*a(n-2) - (n-5)*a(n-1))/(n+1).
a(n) = [x^n] 2/(sqrt(4*x - 12*x^2 + 1) + 1).
a(n) = [x^n] reverse((x^2 + x)/(3*x^2 + 1))/x.

A129637 Number of n-step paths that can go {west, southeast, southwest, northwest} on a 240-degree wedge on the equilateral triangular lattice.

Original entry on oeis.org

1, 3, 11, 41, 157, 607, 2367, 9277, 36505, 144059, 569779, 2257521, 8957109, 35579351, 141460391, 562871557, 2241129905, 8928207987, 35584894299, 141886838329, 565938926669
Offset: 0

Views

Author

Rebecca Xiaoxi Nie (rebecca.nie(AT)utoronto.ca), May 31 2007

Keywords

Comments

If we use the "hour hand" positions at 1, 3, 5, 7, 9, and 11 o'clock on a 12-hour clock to specify directions in the triangular lattice, the allowable steps are in directions 5, 7, 9, and 11 and the path is restricted to stay on or above the 1-7 line. In the Mathematica recurrence below, a(n,k) denotes the number of paths of length n ending k units from the 1-7 line, counted by the last step. - David Callan, Jul 22 2008

Examples

			a(1) = 3 because only 3 out of the 4 steps are permissible from the origin;
a(2) = 11 because the northwest and west steps are followed by 4 permissible steps each, but the southwest step is only followed by 3 permissible steps.
		

Crossrefs

Cf. A129400.

Programs

  • Mathematica
    a[0,0]=1; a[n_,k_]/;k<0 || k>n := 0; a[n_,k_]/;0<=k<=n := a[n,k] = 2a[n-1,k-1] + a[n-1,k] + a[n-1,k+1]; a[n_]:=Sum[a[n,k],{k,0,n}]; Table[a[n],{n,0,10}] (* David Callan, Jul 22 2008 *)
  • Maxima
    a(n):=sum(binomial(n+1,k)*sum(2^(i+k-1)*binomial(k,i)*(-1)^(n-i)*binomial(n-i-1,k-i-1),i,0,n),k,0,n+1)/(n+1); /* Vladimir Kruchinin, Feb 28 2016 */
    
  • PARI
    a(n) = {sum(k=0, n+1, binomial(n+1, k) * sum(i=0,n, 2^(i+k-1)*binomial(k,i)*(-1)^(n-i)*binomial(n-i-1,k-i-1)))/(n+1)} \\ Andrew Howroyd, Dec 22 2017

Formula

Recurrence: (-28-28*n)*a(n) + (-13-n)*a(1+n) + (21+6*n)*a(n+2) + (-4-n)*a(n+3), a(0) = 1, a(1) = 3, a(2) = 11.
G.f.: (1/4*i)*sqrt(-1+2*t+7*t^2)/((-1+4*t)*t)-(1/4)*(-1+5*t)/(t*(-1+4*t)), where i is the imaginary unit.
Differential equation: -(1+28*t^3-6*t+t^2)*t*((d/dt)f(t)) + (9*t-12*t^2-1-28*t^3)*f(t) + 1 - 3*t, f(0) = 1.
a(n) = Sum_{k=0..n+1}(binomial(n+1,k)*Sum_{i=0..n}(2^(i+k-1)*binomial(k,i)*(-1)^(n-i)*binomial(n-i-1,k-i-1)))/(n+1). - Vladimir Kruchinin, Feb 28 2016
a(n) ~ 2^(2*n-1). - Vaclav Kotesovec, Feb 28 2016

A132900 Colored Motzkin paths where each of the steps has three possible colors.

Original entry on oeis.org

1, 3, 18, 108, 729, 5103, 37179, 277749, 2119203, 16435305, 129199212, 1027098306, 8243181351, 66698502705, 543507899346, 4456368744804, 36738955831707, 304354824214977, 2532328310730798, 21152326520189628, 177310026608555619, 1491097815365481477
Offset: 0

Views

Author

Paul Barry, Sep 04 2007

Keywords

Crossrefs

Programs

  • Maple
    seq(9^n * simplify(hypergeom([3/2, -n], [3], 4/3)), n = 0..20); # Peter Bala, Feb 04 2024
  • Mathematica
    CoefficientList[Series[(1-3*x-Sqrt[1-6*x-27*x^2])/(18*x^2), {x, 0, 20}], x] (* Vaclav Kotesovec, Oct 20 2012 *)
  • PARI
    my(x='x+O('x^50)); Vec((1-3*x-sqrt(1-6*x-27*x^2))/(18*x^2)) \\ G. C. Greubel, Mar 21 2017

Formula

G.f.: (1-3*x-sqrt(1-6*x-27*x^2))/(18*x^2).
G.f. is the reversion of x/(1+3*x+9*x^2).
a(n) = 3^n * A001006(n).
a(n) = Sum_{k=0..floor(n/2)} C(n,2k)*C(k)*3^(n-2k)*3^k*3^k, where C(n) = A000108(n).
a(n) = (1/(2*Pi))*Integral_{x=-3..9} x^n*sqrt(27 + 6x - x^2)/9.
Conjecture: (n+2)*a(n) - 3*(2*n+1)*a(n-1) + 27*(1-n)*a(n-2) = 0. - R. J. Mathar, Nov 14 2011
a(n) ~ 3^(2*n+3/2)/(2*sqrt(Pi)*n^(3/2)). - Vaclav Kotesovec, Oct 20 2012
G.f.: 1/G(x), with G(x) = 1-3*x-9*x^2/G(x) (Jacobi continued fraction). - Nikolaos Pantelidis, Feb 01 2023
From Peter Bala, Feb 02 2024: (Start)
G.f.: 1/(1 + 3*x)*c(3*x/(1 + 3*x))^2 = 1/(1 - 9*x)*c(-3*x/(1 - 9*x))^2, where c(x) = (1 - sqrt(1 - 4*x))/(2*x) is the g.f. of the Catalan numbers.
a(n) = 3^n *Sum_{k = 0..n} (-1)^(n+k)*binomial(n,k)*Catalan(k+1).
a(n) = 9^n * Sum_{k = 0..n} (-3)^(-k)*binomial(n,k)*Catalan(k+1). (End)
Showing 1-6 of 6 results.