OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
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) ;
fi; end proc:seq(add(add(A026725(i, j), j=0..n), i=0..n), n=0..30); # G. C. Greubel, Oct 26 2019
MATHEMATICA
T[n_, k_]:= T[n, k]= If[n<0, 0, 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[Sum[T[j, k], {k, 0, n}, {j, 0, n}], {n, 0, 30}] (* G. C. Greubel, Oct 26 2019 *)
PROG
(PARI) T(n, k) = if(n<0, 0, 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) )));
vector(31, n, sum(j=0, n-1, sum(i=0, n-1, T(j, i))) ) \\ G. C. Greubel, Oct 26 2019
(Sage)
@CachedFunction
def T(n, k):
if (n<0): return 0
elif (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)
[sum( sum( T(j, k) for k in (0..n)) for j in (0..n)) for n in (0..30)] # G. C. Greubel, Oct 26 2019
(GAP)
T:= function(n, k)
if n<0 then return 0;
elif 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;
List([0..30], n-> Sum([0..n], k-> Sum([0..n], j-> T(j, k) )))); # G. C. Greubel, Oct 26 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved