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

A199915 Triangle read by rows: T(n,k) is the number of n-step paths from (0,0) to (0,k) that stay in the first quadrant (but may touch the axes) consisting of steps (1,0), (0,1), (0,-1) and (-1,1).

Original entry on oeis.org

1, 0, 1, 1, 1, 1, 1, 2, 3, 1, 2, 7, 5, 6, 1, 7, 10, 21, 14, 10, 1, 10, 38, 48, 51, 35, 15, 1, 38, 89, 135, 168, 120, 76, 21, 1, 89, 229, 441, 458, 474, 281, 147, 28, 1, 229, 752, 1121, 1604, 1475, 1188, 637, 260, 36, 1, 752, 1873, 3692, 4772, 5100, 4329, 2800, 1366, 429, 45, 1
Offset: 0

Views

Author

Alois P. Heinz, Nov 11 2011

Keywords

Examples

			T(4,2) = 5: ((1,0),(1,0),(-1,1),(-1,1)); ((1,0),(-1,1),(1,0),(-1,1)); ((0,1),(0,1),(0,1),(0,-1)); ((0,1),(0,1),(0,-1),(0,1)); ((0,1),(0,-1),(0,1),(0,1)).
Triangle begins:
   1;
   0,  1;
   1,  1,  1;
   1,  2,  3,  1;
   2,  7,  5,  6,  1;
   7, 10, 21, 14, 10,  1;
  10, 38, 48, 51, 35, 15,  1;
		

Crossrefs

Cf. A151346 (columns k=0, 1), A000217(n) = T(n+1,n), A151412 (row sums).
T(2n,n) gives A317782.
Cf. A306814.

Programs

  • Maple
    b:= proc(n, k, x, y) option remember;
         `if`(n<0 or x<0 or y<0 or n b(n, k, 0, 0):
    seq(seq(T(n, k), k=0..n), n=0..12);
  • Mathematica
    b[n_, k_, x_, y_] := b[n, k, x, y] = If[n<0 || x<0 || y<0 || nJean-François Alcover, Jan 19 2015, after Alois P. Heinz *)

A306814 Number T(n,k) of n-step paths from (0,0) to (0,k) that stay in the first quadrant (but may touch the axes) consisting of steps (-1,0), (0,1), (0,-1) and (1,-1); triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 1, 2, 0, 1, 2, 3, 3, 0, 1, 7, 5, 6, 4, 0, 1, 10, 23, 9, 10, 5, 0, 1, 38, 35, 51, 14, 15, 6, 0, 1, 89, 131, 84, 94, 20, 21, 7, 0, 1, 229, 355, 309, 168, 155, 27, 28, 8, 0, 1, 752, 874, 947, 608, 300, 237, 35, 36, 9, 0, 1, 1873, 3081, 2292, 2075, 1070, 495, 343, 44, 45, 10, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Mar 11 2019

Keywords

Examples

			T(4,2) = 3:
  [(0,0), (0,1), (0,0), (0,1), (0,2)],
  [(0,0), (0,1), (0,2), (0,1), (0,2)],
  [(0,0), (0,1), (0,2), (0,3), (0,2)].
Triangle T(n,k) begins:
    1;
    0,   1;
    1,   0,   1;
    1,   2,   0,   1;
    2,   3,   3,   0,   1;
    7,   5,   6,   4,   0,   1;
   10,  23,   9,  10,   5,   0,  1;
   38,  35,  51,  14,  15,   6,  0,  1;
   89, 131,  84,  94,  20,  21,  7,  0, 1;
  229, 355, 309, 168, 155,  27, 28,  8, 0, 1;
  752, 874, 947, 608, 300, 237, 35, 36, 9, 0, 1;
  ...
		

Crossrefs

Column k=0 gives A151346.
Row sums give A151404.
T(2n,n) gives A306813.
T(n+1,n-1) gives A001477.
T(n+2,n-1) gives A000217.
T(n+3,n-1) gives A000096.
Cf. A199915.

Programs

  • Maple
    b:= proc(n, x, y) option remember; `if`(min(n, x, y, n-x-y)<0, 0,
          `if`(n=0, 1, add(b(n-1, x-d[1], y-d[2]),
           d=[[-1, 0], [0, 1], [0, -1], [1, -1]])))
        end:
    T:= (n, k)-> b(n, 0, k):
    seq(seq(T(n, k), k=0..n), n=0..12);
  • Mathematica
    b[n_, x_, y_] := b[n, x, y] = If[Min[n, x, y, n - x - y] < 0, 0, If[n == 0, 1, Sum[b[n - 1, x - d[[1]], y - d[[2]]], {d, {{-1, 0}, {0, 1}, {0, -1}, {1, -1}}}]]];
    T[n_, k_] := b[n, 0, k];
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, May 14 2020, after Maple *)
Showing 1-2 of 2 results.