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!)
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). 5

%I #24 Mar 13 2019 12:56:37

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

%T 89,135,168,120,76,21,1,89,229,441,458,474,281,147,28,1,229,752,1121,

%U 1604,1475,1188,637,260,36,1,752,1873,3692,4772,5100,4329,2800,1366,429,45,1

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

%H Alois P. Heinz, <a href="/A199915/b199915.txt">Rows n = 0..140, flattened</a>

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

%e Triangle begins:

%e 1;

%e 0, 1;

%e 1, 1, 1;

%e 1, 2, 3, 1;

%e 2, 7, 5, 6, 1;

%e 7, 10, 21, 14, 10, 1;

%e 10, 38, 48, 51, 35, 15, 1;

%p b:= proc(n, k, x, y) option remember;

%p `if`(n<0 or x<0 or y<0 or n<x or n<abs(k-y), 0,

%p `if`(n=0, 1, add (b(n-1, k, x+d[1], y+d[2]),

%p d=[[1, 0], [0, 1], [0, -1], [-1, 1]])))

%p end:

%p T:= (n, k)-> b(n, k, 0, 0):

%p seq(seq(T(n, k), k=0..n), n=0..12);

%t b[n_, k_, x_, y_] := b[n, k, x, y] = If[n<0 || x<0 || y<0 || n<x || n<Abs[k-y], 0, If[n == 0, 1, Sum[b[n-1, k, x+d[[1]], y+d[[2]]], {d, {{1, 0}, {0, 1}, {0, -1}, {-1, 1}}}]]]; T[n_, k_] := b[n, k, 0, 0]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 12}] // Flatten (* _Jean-François Alcover_, Jan 19 2015, after _Alois P. Heinz_ *)

%Y Cf. A151346 (columns k=0, 1), A000217(n) = T(n+1,n), A151412 (row sums).

%Y T(2n,n) gives A317782.

%Y Cf. A306814.

%K nonn,walk,tabl

%O 0,8

%A _Alois P. Heinz_, Nov 11 2011

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 May 9 12:21 EDT 2024. Contains 372350 sequences. (Running on oeis4.)