OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
FORMULA
Conjecture: G.f.:-1/2*(2*x^6-5*x^4+8*x^3+x-2+x*(x-1)*(x^2+x+1)*(1-4*x^3)^(1/2))/(x^6+4*x^3-1)/(x^2+x-1). - Maksym Voznyy (voznyy(AT)mail.ru), Aug 11 2009
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(A026725(n-k, k), k=0..floor(n/2)), 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[n-k, k], {k, 0, Floor[n/2]}], {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)\2, T(n-j, j)) ) \\ 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( T(n-j, j) for j in (0..floor(n/2))) 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..Int(n/2)], k-> T(n-k, k) )); # G. C. Greubel, Oct 26 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved