login
A026736
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 n is even and k=(n-2)/2, otherwise T(n,k) = T(n-1,k-1) + T(n-1,k).
31
1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 5, 6, 4, 1, 1, 6, 11, 10, 5, 1, 1, 7, 22, 21, 15, 6, 1, 1, 8, 29, 43, 36, 21, 7, 1, 1, 9, 37, 94, 79, 57, 28, 8, 1, 1, 10, 46, 131, 173, 136, 85, 36, 9, 1, 1, 11, 56, 177, 398, 309, 221, 121, 45, 10, 1, 1, 12, 67, 233, 575, 707, 530, 342, 166, 55, 11, 1
OFFSET
0,5
COMMENTS
T(n, k) is the number of paths from (0, 0) to (n-k, k) in 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, i+2)-to-(i+1, i+3) for i >= 0.
EXAMPLE
Triangle begins
1;
1, 1;
1, 2, 1;
1, 3, 3, 1;
1, 5, 6, 4, 1;
1, 6, 11, 10, 5, 1;
1, 7, 22, 21, 15, 6, 1;
1, 8, 29, 43, 36, 21, 7, 1;
1, 9, 37, 94, 79, 57, 28, 8, 1;
1, 10, 46, 131, 173, 136, 85, 36, 9, 1;
1, 11, 56, 177, 398, 309, 221, 121, 45, 10, 1;
1, 12, 67, 233, 575, 707, 530, 342, 166, 55, 11, 1;
...
MATHEMATICA
T[_, 0] = T[n_, n_] = 1; T[n_, k_] := T[n, k] = If[EvenQ[n] && k == (n-2)/2, T[n-1, k-1] + T[n-2, k-1] + T[n-1, k], T[n-1, k-1] + T[n-1, k]];
Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jul 22 2018 *)
PROG
(PARI)
T(n, k) = if(k==n || k==0, 1, if((n%2)==0 && k==(n-2)/2, T(n-1, k-1) + T(n-2, k-1) + T(n-1, k), T(n-1, k-1) + T(n-1, k) ));
for(n=0, 12, for(k=0, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Jul 16 2019
(Sage)
def T(n, k):
if (k==0 or k==n): return 1
elif (mod(n, 2)==0 and k==(n-2)/2): return T(n-1, k-1) + T(n-2, k-1) + T(n-1, k)
else: return T(n-1, k-1) + T(n-1, k)
[[T(n, k) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Jul 16 2019
(GAP)
T:= function(n, k)
if k=0 or k=n then return 1;
elif (n mod 2)=0 and k=Int((n-2)/2) then return T(n-1, k-1) + T(n-2, k-1) + T(n-1, k);
else return T(n-1, k-1) + T(n-1, k);
fi;
end;
Flat(List([0..12], n-> List([0..n], k-> T(n, k) ))); # G. C. Greubel, Jul 16 2019
CROSSREFS
Row sums give A026743.
T(2n,n) gives A026737(n) or A111279(n+1).
Sequence in context: A138201 A220614 A154221 * A230859 A213086 A050446
KEYWORD
nonn,tabl,walk
EXTENSIONS
Offset corrected by Alois P. Heinz, Jul 23 2018
STATUS
approved