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

A220894 Number of closed lambda-terms of size n with size 0 for the variables.

Original entry on oeis.org

0, 1, 3, 14, 82, 579, 4741, 43977, 454283, 5159441, 63782411, 851368766, 12188927818, 186132043831, 3017325884473, 51712139570022, 933654684562038, 17702959714232057, 351535449888420187, 7292626296788508624, 157698798590301690864, 3547597554377118966359
Offset: 0

Views

Author

N. J. A. Sloane, Dec 31 2012

Keywords

Crossrefs

Cf. A220895 (one free variable), A220896 (two free variables), A220897 (three free variables).

Programs

  • Haskell
    t :: Int -> Int -> Integer
    t 0 m = (fromIntegral m)
    t n m = t (n-1) (m+1) + foldl (+) 0 (let tt = [t i m | i<- [0..(n-1)]] in
                                          (map (uncurry (*)) (zip tt (reverse tt))))
    -- Pierre Lescanne, Mar 18 2013
    
  • Haskell
    -- The following program is more efficient:
    with memoization
    ttab :: [[Integer]]
    ttab = [0..] : [[ttab !! (n-1) !! (m+1) + s n m | m <- [0..]] | n <- [1..]]
      where s n m  = let ti = [ttab !! i !! m | i <- [0..(n-1)]] in foldl (+) 0 (map (uncurry (*)) (zip ti (reverse ti)))
    t :: Int -> Int -> Integer
    t n m = ttab !! n !! m
    -- Pierre Lescanne, Mar 20 2013
  • Maple
    a:= n-> T(n, 0):
    T:= proc(n, m) option remember; `if`(n=0, m,
          T(n-1, m+1) +add(T(i, m)*T(n-1-i, m), i=0..n-1))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Mar 20 2013
  • Mathematica
    Clear[t]; t[0, m_] := m; t[n_, m_] := t[n, m] = t[n-1, m+1] + Sum[t[i, m]*t[n-1-i, m], {i, 0, n-1}]; a[n_] := t[n, 0]; Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Apr 04 2013 *)
  • Sage
    @CachedFunction
    def T(n, m):
        if n == 0: return m
        return T(n-1, m+1) + sum(T(i, m) * T(n-1-i, m) for i in range(n))
    def a(n):
        return T(n,0)
    [a(n) for n in range(66)]
    # Joerg Arndt, Jan 01 2013
    

Formula

T(n,0) where
T(0,m) = m;
T(n+1,m) = T(n,m+1) + sum_{i=0 to n} T(i,m) * T(n-i,m).
f(n,0) where f(0,1) = 1; f(0,k) = 0 if k!=1; f(n,k) = 0 if k>2n-1; f(n,k) = f(n-1,k) + f(n-1,k+1) + sum_{p=1 to n-2} sum_{c=0 to k} sum_{l=0 to k - c} [C^c_k C^l_(k-c) f(p,l+c) f(n-p-1,k-l)], where C^p_n are binomial coefficients (the last term is for the application where "c" is the number of common variables in both subterms). f(n,k) can be computed only using f(n',k') with n' < n and k' <= k + n - n'. f(n,k) is the number of lambda terms of size n (with size 0 for the variables) having exactly k free variables.
c(n,0) where
c(0,1) = 1; c(0,i) if i!=1;
c(n+1,i) sum{j=i to n+1} binomial(j,i) * c(n,j) + sum{j=0 to i} sum{k=0..n} c(k,j)* c(n-k,i-j).
G.f.: L(z,0) where L(z,u) = u + z*L(z,u+1) + z*L(z,u)^2. - Pierre Lescanne, Mar 14 2013

Extensions

More terms from Joerg Arndt, Jan 01 2013

A224345 Number of closed normal forms of size n in lambda calculus with size 0 for the variables.

Original entry on oeis.org

1, 3, 11, 53, 323, 2359, 19877, 188591, 1981963, 22795849, 284285351, 3815293199, 54762206985, 836280215979, 13527449608779, 230894574439485, 4144741143359355, 78017419806432567, 1535903379571939981, 31550210953904250759
Offset: 1

Views

Author

Pierre Lescanne, Apr 04 2013

Keywords

Crossrefs

Cf. A195691 for another size of the terms.

Programs

  • Haskell
    gtab :: [[Integer]]
    gtab = [0..] : [[s n m |  m <- [0..]] | n <- [1..]]
      where s n m  = let fi =  [ftab !! i !! m | i <- [0..(n-1)]]
                         gi =  [gtab !! i !! m | i <- [0..(n-1)]]
                     in foldl (+) 0 (map (uncurry (*)) (zip fi (reverse gi)))
    ftab :: [[Integer]]
    ftab = [0..] : [[ftab !! (n-1) !! (m+1) + gtab !! n !! m | m<-[0..]] | n<-[1..]]
    f(n,m) = ftab !! n !! m
  • Mathematica
    F[0, m_] := m; F[n_, m_] := F[n, m] = F[n-1, m+1] + G[n, m]; G[0, m_] := m; G[n_, m_] := G[n, m] = Sum[G[n-k-1, m]*F[k, m], {k, 0, n-1}]; a[n_] := F[n, 0]; Array[a, 20] (* Jean-François Alcover, May 23 2017 *)

Formula

a(n) = F(n,0) where F(0,m) = m, F(n+1,m) = F(n,m+1) + G(n+1,m), and G(0,m) = m, G(n+1,m) = sum(k=0..n, G(n-k,m)*F(k,m)*d(n,0) ) where d(0,i) = [i = 1], d(n+1,i) = sum(j=i..n+1, binomial(j,i)*d(n,j) + g(n+1,j) ) and g(0,i) = [i = 1], g(n+1,i) = sum(j=0..i, sum(k=0..n, g(k,j)*d(n-k,i-j) ) ).

A300126 Number of Motzkin trees that are "uniquely closable skeletons".

Original entry on oeis.org

0, 1, 0, 1, 1, 2, 2, 7, 5, 20, 19, 60, 62, 202, 202, 679, 711, 2304, 2507, 8046, 8856, 28434, 31855, 101288, 115596, 364710, 421654, 1323946, 1549090, 4836072, 5724582, 17771683, 21250527, 65653884, 79227989, 243639954, 296543356, 907841678, 1113706887
Offset: 0

Views

Author

Michael De Vlieger, Feb 25 2018

Keywords

Comments

From the Bodini-Tarau paper: "Uniquely closable skeletons of lambda terms are Motzkin-trees that predetermine the unique closed lambda term that can be obtained by labeling their leaves with de Bruijn indices".
For the relation to the set of Motzkin trees where all leaves are at the same unary height see A321396. - Peter Luschny, Nov 14 2018

Crossrefs

Cf. A000108, A001006, A135501, A321396 (row 1).

Programs

  • Magma
    m:=50; R:=PowerSeriesRing(Rationals(), m); [0] cat Coefficients(R!( (1-Sqrt(1 + 2*x*(Sqrt(1-4*x^2) -1)))/(2*x^2) )); // G. C. Greubel, Nov 14 2018
    
  • Maple
    gf := -(sqrt(2*z*(sqrt(1 - 4*z^2) - 1) + 1) - 1)/(2*z^2):
    series(gf, z, 44): seq(coeff(%, z, n), n=0..38); # Peter Luschny, Nov 14 2018
  • Mathematica
    CoefficientList[Series[(1-Sqrt[1 + 2*x*(Sqrt[1-4*x^2]-1)])/(2*x^2), {x,0, 50}], x] (* G. C. Greubel, Nov 14 2018 *)
  • PARI
    x='x+O('x^50); concat([0], Vec((1-sqrt(1 + 2*x*(sqrt(1-4*x^2) -1)))/(2*x^2))) \\ G. C. Greubel, Nov 14 2018
    
  • Sage
    s= (-(sqrt(2*x*(sqrt(1 - 4*x^2) - 1) + 1) - 1)/(2*x^2)).series(x, 30);
    s.coefficients(x, sparse=False) # G. C. Greubel, Nov 14 2018

Formula

G.f.: -(sqrt(2*z*(sqrt(1 - 4*z^2) - 1) + 1) - 1)/(2*z^2). - Peter Luschny, Nov 14 2018

A300125 Number of closable Motzkin trees.

Original entry on oeis.org

0, 1, 1, 2, 5, 11, 26, 65, 163, 417, 1086, 2858, 7599, 20391, 55127, 150028, 410719, 1130245, 3124770, 8675210, 24175809, 67603633, 189633981, 533463183, 1504644945, 4254179693, 12055097308, 34231674486, 97392368007, 277590288931, 792528581088
Offset: 0

Views

Author

Michael De Vlieger, Feb 25 2018

Keywords

Comments

From the Bodini-Tarau paper: a closable Motzkin tree is "the skeleton of at least one closed lambda term".

Crossrefs

Programs

  • Maple
    f:= gfun:-rectoproc({
      (384*n^2 +384*n)        *a(n  ) +
      (-32*n^2-512*n-480)     *a(n+1) +
      (-368*n^2 -2192*n-2928) *a(n+2) +
      (-56*n^2 -344*n-504)    *a(n+3) +
      (-4*n^2 +188*n+852)     *a(n+4) +
      (110*n^2 +1034*n+2328)  *a(n+5) +
      (-21*n^2 -201*n-390)    *a(n+6) +
      (-21*n^2 -327*n-1272)   *a(n+7) +
      (9*n^2 +153*n+648)      *a(n+8) +
      (-n^2 -19*n-90)         *a(n+9) = 0,
      a(0) = 0, a(1) = 0, a(2) = 1, a(3) = 1, a(4) = 2, a(5) = 5, a(6) = 11, a(7) = 26, a(8) = 65
    }, a(n), remember): map(f, [$1..64]); # Georg Fischer, Mar 29 2020 (from the Bodini-Tarau paper)

Extensions

More terms from Georg Fischer, Mar 29 2020

A300127 Number of Motzkin trees that are "typable closed terms".

Original entry on oeis.org

0, 1, 2, 3, 10, 34, 98, 339, 1263, 4626, 18099, 73782, 306295, 1319660, 5844714, 26481404, 123172740
Offset: 0

Views

Author

Michael De Vlieger, Feb 25 2018

Keywords

Comments

From the Bodini-Tarau paper: a Motzkin skeleton is called "typable" if "it exists at least one simply-typed closed lambda term having it as its skeleton".

Crossrefs

A300128 Number of Motzkin trees that are "typable closable skeletons".

Original entry on oeis.org

0, 1, 1, 1, 5, 9, 17, 55, 122, 289, 828, 2037, 5239, 14578, 37942, 101307, 281041, 755726, 2062288
Offset: 0

Views

Author

Michael De Vlieger, Feb 25 2018

Keywords

Comments

From the Bodini-Tarau paper: a Motzkin skeleton is called "typable" if "it exists at least one simply-typed closed lambda term having it as its skeleton".

Crossrefs

A300129 Number of Motzkin trees that are "untypable closable skeletons".

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 9, 10, 41, 128, 258, 821, 2360, 5813, 17185, 48721, 129678, 374519
Offset: 0

Views

Author

Michael De Vlieger, Feb 25 2018

Keywords

Comments

From the Bodini-Tarau paper: a Motzkin skeleton is called "typable" if "it exists at least one simply-typed closed lambda term having it as its skeleton. An untypable skeleton is a closable skeleton for which no such term exists."

Crossrefs

A300130 Number of Motzkin trees that are a "uniquely typable skeleton".

Original entry on oeis.org

0, 1, 0, 0, 2, 0, 1, 7, 1, 13, 34, 20, 100, 226, 234, 853, 1877, 2650, 8128, 18116, 30483, 85713
Offset: 0

Views

Author

Michael De Vlieger, Feb 25 2018

Keywords

Comments

From the Bodini-Tarau paper: "A uniquely typable skeleton is one for which it exists exactly one simply-typed closed lambda term having it as a skeleton."

Crossrefs

Showing 1-8 of 8 results.