OFFSET
0,9
LINKS
FORMULA
a(n) = N(1,0,n) with
N(q,k,0) = N(q,k,1) = 0
N(q,k,n+2) = (if k>n then 1 else 0) +
q * N(1,k+1,n) +
Sum_{i=0..n} N(0,k,i) * N(1,k,n-i)
EXAMPLE
This sequence first differs from A114852 at n=10, where it excludes the two reducible terms (lambda x.x)(lambda x.x) and lambda x.(lambda x.x)x, so normal 10 = (closed 10)-2 = 6-2 = 4.
MATHEMATICA
A[_, _, 0] = A[_, _, 1] = 0; A[q_, k_, n_] := A[q, k, n] = Boole[k > n-2] + q*A[1, k+1, n-2] + Sum[A[0, k, i]*A[1, k, n-i-2], {i, 0, n-2}];
a[n_] := A[1, 0, n];
Table[a[n], {n, 0, 44}] (* Jean-François Alcover, May 23 2017 *)
PROG
(Haskell)
a195691 = normal True 0 where
normal qLam k n = if n<2 then 0 else
(if n-2<k then 1 else 0) +
(if qLam then normal True (k+1) (n-2) else 0) +
sum [normal False k i * normal True k (n-2-i) | i <- [0..n-2]]
-- See link for a more efficient version.
CROSSREFS
KEYWORD
nonn
AUTHOR
John Tromp, Sep 22 2011
STATUS
approved