OFFSET
-1,9
COMMENTS
For n >= 2, T(n,k) = number of nonnegative integer strings s(0),...,s(n) such that s(0)=1, s(n)=n-k, |s(1)-1|=1, |s(i)-s(i-1)|<=1 for i >= 2.
FORMULA
T(i, 0)=1 for i >= -1; T(0, 1)=0; T(1, 1)=1, T(1, 2)=0; for i >= 2, T(i, 1)=i-1, T(i, i+1)=T(i-1, i-1)+T(i-1, i), T(i, j)=T(i-1, j-2)+T(i-1, j-1)+T(i-1, j) for j=2, 3, ...., i.
G.f. of right-hand columns is (1-z)^2*M^k, with M the g.f. of the Motzkin numbers (A001006).
EXAMPLE
1;
1,0;
1,1,0;
1,1,2,1;
1,2,4,4,3;
1,3,7,10,11,7;
...
PROG
(PARI) T(i, j)=if(j<0||j>i+1, 0, if(j==0, 1, if(j==1, if(i>1, i-1, i>0), if(i+1==j, if(i==1, 0, T(i-1, i-1)+T(i-1, i)), T(i-1, j-2)+T(i-1, j-1)+T(i-1, j))))) \\ Ralf Stephan
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
EXTENSIONS
Edited by Ralf Stephan, Dec 18 2004
a(26) corrected and more terms from Sean A. Irvine, Sep 17 2019
STATUS
approved