|
|
A135231
|
|
Row sums of triangle A135230.
|
|
2
|
|
|
1, 2, 4, 6, 12, 22, 44, 86, 172, 342, 684, 1366, 2732, 5462, 10924, 21846, 43692, 87382, 174764, 349526, 699052, 1398102, 2796204, 5592406, 11184812, 22369622, 44739244, 89478486, 178956972, 357913942, 715827884, 1431655766, 2863311532, 5726623062, 11453246124, 22906492246, 45812984492
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
|
|
FORMULA
|
a(2*n+1) = A005578(n+1) if n is odd.
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) for n > 3.
G.f.: (-2*x^3 - x^2 + 1)/((x - 1)*(x + 1)*(2*x - 1)). (End)
|
|
EXAMPLE
|
a(3) = 6 = sum of row 4 terms of triangle A135230; (1 + 2 + 2 + 1).
|
|
MAPLE
|
T:= proc(n, k) option remember;
if k=n then 1
elif k=0 then (3+(-1)^n)/2
else add(binomial(n-2*j-1, k-1), j=0..floor((n-1)/2))
fi; end:
seq( add(T(n, j), j=0..n), n=0..40); # G. C. Greubel, Nov 20 2019
|
|
MATHEMATICA
|
T[n_, k_]:= T[n, k]= If[k==n, 1, If[k==0, (3+(-1)^n)/2, Sum[Binomial[n-1 - 2*j, k-1], {j, 0, Floor[(n-1)/2]}]]]; Table[Sum[T[n, j], {j, 0, n}], {n, 0, 40}] (* G. C. Greubel, Nov 20 2019 *)
|
|
PROG
|
(PARI) T(n, k) = if(k==n, 1, if(k==0, (3+(-1)^n)/2, sum(j=0, (n-1)\2, binomial( n-2*j-1, k-1)) )); \\ G. C. Greubel, Nov 20 2019
(Magma)
function T(n, k)
if k eq n then return 1;
elif k eq 0 then return (3+(-1)^n)/2;
else return (&+[Binomial(n-2*j-1, k-1): j in [0..Floor((n-1)/2)]]);
end if; return T; end function;
[(&+[T(n, j): j in [0..n]]): n in [0..40]]; // G. C. Greubel, Nov 20 2019
(Sage)
@CachedFunction
def T(n, k):
if (k==n): return 1
elif (k==0): return (3+(-1)^n)/2
else: return sum(binomial(n-2*j-1, k-1) for j in (0..floor((n-1)/2)))
[sum(T(n, j) for j in (0..n)) for n in (0..40)] # G. C. Greubel, Nov 20 2019
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Terms a(16) onward added and offset changed by G. C. Greubel, Nov 20 2019
|
|
STATUS
|
approved
|
|
|
|