OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,6,-6).
FORMULA
a(n) = Sum_{i=0..2*n} Sum_{j=0..n-1} A026519(j, i).
G.f.: x*(1+3*x)/((1-x)*(1-6*x^2)). - Ralf Stephan, Feb 03 2004
a(n) = (1/60)*( 6^((n+1)/2)*( (4*sqrt(6) - 9)*(-1)^n + (4*sqrt(6) + 9) ) - 48 ). - G. C. Greubel, Dec 20 2021
MATHEMATICA
LinearRecurrence[{1, 6, -6}, {1, 4, 10}, 40] (* G. C. Greubel, Dec 20 2021 *)
PROG
(Magma) I:=[1, 4, 10]; [n le 3 select I[n] else Self(n-1) +6*Self(n-2) -6*Self(n-3): n in [1..40]]; // G. C. Greubel, Dec 20 2021
(Sage)
@CachedFunction
def T(n, k): # T = A026519
if (k<0 or k>2*n): return 0
elif (k==0 or k==2*n): return 1
elif (k==1 or k==2*n-1): return (n+1)//2
elif (n%2==0): return T(n-1, k) + T(n-1, k-2)
else: return T(n-1, k) + T(n-1, k-1) + T(n-1, k-2)
@CachedFunction
def a(n): return sum( sum( T(j, i) for i in (0..2*n) ) for j in (0..n-1) )
[a(n) for n in (1..40)]
(PARI) Vec((1+3*x)/((1-x)*(1-6*x^2))+O(x^99)) \\ Charles R Greathouse IV, Jan 24 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved