login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A034928 Triangle of ballot numbers. 2

%I #22 Sep 20 2014 09:45:00

%S 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,

%T 36,51,51,1,1,7,12,30,54,91,127,127,1,1,8,14,39,75,142,232,323,323,1,

%U 1,9,16,49,99,205,370,603,835,835,1,1,10,18,60,126,281,545

%N Triangle of ballot numbers.

%H Reinhard Zumkeller, <a href="/A034928/b034928.txt">Rows n = 0..125 of triangle, flattened</a>

%H M. Aigner, <a href="http://dx.doi.org/10.1006/eujc.1998.0235">Motzkin Numbers</a>, Europ. J. Comb. 19 (1998), 663-675.

%F 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).

%F 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.

%e Triangle begins

%e 1, 1,

%e 1, 1, 1,

%e 1, 1, 2, 2,

%e 1, 1, 3, 4, 4,

%e 1, 1, 4, 6, 9, 9,

%e 1, 1, 5, 8, 15, 21, 21,

%e 1, 1, 6, 10, 22, 36, 51, 51,

%e 1, 1, 7, 12, 30, 54, 91, 127, 127,

%e 1, 1, 8, 14, 39, 75, 142, 232, 323, 323,

%e 1, 1, 9, 16, 49, 99, 205, 370, 603, 835, 835,

%e ...

%t 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_) *)

%o (Haskell)

%o a034928 n k = a034928_tabf !! n !! k

%o a034928_row n = a034928_tabf !! n

%o a034928_tabf = iterate f [1,1] where

%o f us = vs ++ [last vs] where

%o vs = zipWith (+) us (0 : scanl (+) 0 us)

%o -- _Reinhard Zumkeller_, Sep 20 2014

%Y Right-hand edge is A001006.

%Y Cf. A247364 (mirrored).

%K nonn,tabf,easy

%O 0,8

%A _N. J. A. Sloane_.

%E More terms from _David W. Wilson_.

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 09:18 EDT 2024. Contains 371935 sequences. (Running on oeis4.)