login
Triangular array T read by rows: T(n,0)=T(n,n)=1 for n >= 0; for n >= 2 and 1<=k<=n-1, T(n,k)=T(n-1,k-1)+T(n-2,k-1)+T(n-1,k) if k=[ (n-1)/2 ] or k=[ n/2 ] or k=[ (n+2)/2 ], else T(n,k)=T(n-1,k-1)+T(n-1,k).
16

%I #16 Mar 23 2020 13:02:02

%S 1,1,1,1,3,1,1,5,5,1,1,7,13,7,1,1,8,25,25,8,1,1,9,40,63,40,9,1,1,10,

%T 49,128,128,49,10,1,1,11,59,217,319,217,59,11,1,1,12,70,276,664,664,

%U 276,70,12,1,1,13,82,346,1157,1647,1157,346,82,13,1

%N Triangular array T read by rows: T(n,0)=T(n,n)=1 for n >= 0; for n >= 2 and 1<=k<=n-1, T(n,k)=T(n-1,k-1)+T(n-2,k-1)+T(n-1,k) if k=[ (n-1)/2 ] or k=[ n/2 ] or k=[ (n+2)/2 ], else T(n,k)=T(n-1,k-1)+T(n-1,k).

%F T(n, k) = number of paths from (0, 0) to (n-k, k) in the directed graph having vertices (i, j) and edges (i, j)-to-(i+1, j) and (i, j)-to-(i, j+1) for i, j >= 0 and edges (i, j)-to-(i+1, j+1) if |i-j|<=2.

%e 1

%e 1 1

%e 1 3 1

%e 1 5 5 1

%e 1 7 13 7 1

%e 1 8 25 25 8 1

%e 1 9 40 63 40 9 1

%e 1 10 49 128 128 49 10 1

%e 1 11 59 217 319 217 59 11 1

%e 1 12 70 276 664 664 276 70 12 1

%e 1 13 82 346 1157 1647 1157 346 82 13 1

%e 1 14 95 428 1503 3468 3468 1503 428 95 14 1

%e 1 15 109 523 1931 6128 8583 6128 1931 523 109 15 1

%p A026714 := proc(n,k)

%p option remember;

%p if n < 0 or k < 0 then

%p 0;

%p elif n =0 or n= k then

%p 1;

%p elif k = floor((n-1)/2) or k = floor(n/2) or k = floor(n/2+1) then

%p procname(n-1,k-1)+procname(n-2,k-1)+procname(n-1,k) ;

%p else

%p procname(n-1,k-1)+procname(n-1,k) ;

%p end if;

%p end proc: # _R. J. Mathar_, Oct 21 2019

%t T[n_, k_] := T[n, k] = Which[n < 0 || k < 0, 0, n == 0 || n == k, 1, k == Floor[(n - 1)/2] || k == Floor[n/2] || k == Floor[n/2 + 1], T[n - 1, k - 1] + T[n - 2, k - 1] + T[n - 1, k], True, T[n - 1, k - 1] + T[n - 1, k]];

%t Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Mar 23 2020 *)

%Y Cf. A026721 (row sums).

%K nonn,tabl

%O 1,5

%A _Clark Kimberling_