OFFSET
0,5
COMMENTS
T(n+2,n) = A134869(n+1). - Philippe Deléham, Feb 01 2014
LINKS
G. C. Greubel, Rows n = 0..99 of triangle, flattened
Rob Arthan, Comments on A026674, A026725, A026670
FORMULA
T(n, k) = 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+1)-to-(i+1, i+2) for i >= 0.
Comment from Rick L. Shepherd, Aug 05 2002: Probably this should be changed to "and edges (i+1, i)-to-(i+2, i+1) for i >= 0."
EXAMPLE
Triangle begins:
1
1 1
1 2 1
1 4 3 1
1 5 7 4 1
1 6 16 11 5 1
1 7 22 27 16 6 1
1 8 29 65 43 22 7 1
1 9 37 94 108 65 29 8 1
1 10 46 131 267 173 94 37 9 1
1 11 56 177 398 440 267 131 46 10 1
1 12 67 233 575 1105 707 398 177 56 11 1
... - Philippe Deléham, Feb 01 2014
MAPLE
A026725 := proc(n, k)
option remember;
if n < 0 or k < 0 then
0;
elif k=0 or k=n then
1;
elif 2*k = n-1 then
procname(n-1, k-1)+procname(n-2, k-1)+procname(n-1, k) ;
else
procname(n-1, k-1)+procname(n-1, k) ;
end if;
end proc: # R. J. Mathar, Oct 21 2019
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k==0||k==n, 1, If[OddQ[n] && k==(n-1)/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, 14}, {k, 0, n}]//Flatten (* G. C. Greubel, Jul 16 2019 *)
PROG
(PARI) T(n, k) = if(k==n || k==0, 1, if(2*k==n-1, 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, 11, for(k=0, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Jul 16 2019
(Sage)
@CachedFunction
def T(n, k):
if (k==0 or k==n): return 1
elif (mod(n, 2)==0 and k==(n-1)/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..14)] # G. C. Greubel, Jul 16 2019
(GAP)
T:= function(n, k)
if k=0 or k=n then return 1;
elif 2*k=n-1 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..14], n-> List([0..n], k-> T(n, k) ))); # G. C. Greubel, Jul 16 2019
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
EXTENSIONS
Title and offset corrected by G. C. Greubel, Jul 16 2019, again by R. J. Mathar, Oct 21 2019, again by Sean A. Irvine, Oct 25 2019
STATUS
approved