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

A034928 Triangle of ballot numbers.

Original entry on oeis.org

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, 1, 1, 10, 18, 60, 126, 281, 545
Offset: 0

Views

Author

Keywords

Examples

			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,
...
		

Crossrefs

Right-hand edge is A001006.
Cf. A247364 (mirrored).

Programs

  • 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
  • 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) *)

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.

Extensions

More terms from David W. Wilson.
Showing 1-1 of 1 results.