OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = A026520(n+1)/2.
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k>2*n, 0, If[k==0 || k==2*n, 1, If[k==1 || k==2*n-1, Floor[(n+2)/2], If[EvenQ[n], T[n-1, k-2] + T[n-1, k] + T[n-1, k-1], T[n-1, k-2] + T[n-1, k]]]]];
Table[T[n, n-1], {n, 40}] (* G. C. Greubel, Dec 17 2021 *)
PROG
(Sage)
@CachedFunction
def T(n, k): # T = A026552
if (k==0 or k==2*n): return 1
elif (k==1 or k==2*n-1): return (n+2)//2
elif (n%2==0): return T(n-1, k) + T(n-1, k-1) + T(n-1, k-2)
else: return T(n-1, k) + T(n-1, k-2)
[T(n, n-1) for n in (1..40)] # G. C. Greubel, Dec 17 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved