OFFSET
0,8
LINKS
Reinhard Zumkeller, Rows n = 0..125 of triangle, flattened
M. Aigner, Motzkin Numbers, Europ. J. Comb. 19 (1998), 663-675.
FORMULA
a(0, 0)=a(0, 1)=1, a(n, n+1)=a(n, n), a(n, k)=a(n-1, 0)+...+a(n-1, k-2)+a(n-1, k) (n >= 1, 0<=k<=n).
Or, from David W. Wilson: a(n, 0) = 1; a(n, 1) = 1; a(n, 2) = n; a(n, k) = 0 if k > n+1; a(n, k) = a(n-1, k) + a(n, k-1) + a(n-1, k-2) - a(n-1, k-1) otherwise.
EXAMPLE
Triangle begins
1, 1,
1, 1, 1,
1, 1, 2, 2,
1, 1, 3, 4, 4,
1, 1, 4, 6, 9, 9,
1, 1, 5, 8, 15, 21, 21,
1, 1, 6, 10, 22, 36, 51, 51,
1, 1, 7, 12, 30, 54, 91, 127, 127,
1, 1, 8, 14, 39, 75, 142, 232, 323, 323,
1, 1, 9, 16, 49, 99, 205, 370, 603, 835, 835,
...
MATHEMATICA
a[n_, 0] := 1; a[n_, 1] := 1; a[n_, 2] := n; a[n_, k_] := If [k > n + 1, 0, a[n - 1, k] + a[n, k - 1] + a[n - 1, k - 2] - a[n - 1, k - 1]]; Grid[Table[a[n, k], {n, 0, 10}, {k, 0, n + 1}]] (* Replace Grid with Flatten to get the sequence. *) (* L. Edson Jeffery, Aug 02 2014 (after David W. Wilson) *)
PROG
(Haskell)
a034928 n k = a034928_tabf !! n !! k
a034928_row n = a034928_tabf !! n
a034928_tabf = iterate f [1, 1] where
f us = vs ++ [last vs] where
vs = zipWith (+) us (0 : scanl (+) 0 us)
-- Reinhard Zumkeller, Sep 20 2014
CROSSREFS
KEYWORD
nonn,tabf,easy
AUTHOR
EXTENSIONS
More terms from David W. Wilson.
STATUS
approved