OFFSET
0,5
LINKS
G. C. Greubel, Rows n = 0..100 of triangle, flattened
FORMULA
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, 2h+i)-to-(i+1, 2h+i+1) for i >= 0, h>=0.
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 3, 1;
1, 4, 4, 1;
1, 6, 11, 5, 1;
1, 7, 17, 16, 6, 1;
1, 9, 30, 44, 22, 7, 1;
MAPLE
A026747 := proc(n, k)
if k=0 or k = n then
1;
elif type(n, 'even') and k <= n/2 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, Jun 30 2013
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k==0 || k==n, 1, If[EvenQ[n] && 1<=k<=n/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 (* G. C. Greubel, Oct 28 2019 *)
PROG
(PARI) T(n, k) = if(k==0 || k==n, 1, if(n%2==0 && k<=n/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, Oct 28 2019
(Sage)
def T(n, k):
if (k==0 or k==n): return 1
elif (mod(n, 2)==0 and k<=n/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, Oct 28 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)+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..12], n-> List([0..n], k-> T(n, k) ))); # G. C. Greubel, Oct 28 2019
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
EXTENSIONS
More terms added by G. C. Greubel, Oct 28 2019
STATUS
approved