OFFSET
0,2
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (6,-13,12,-4).
FORMULA
For n>1, a(n) = 7*(n+2)*2^(n-3) - n - 2.
From Colin Barker, Feb 18 2016: (Start)
a(n) = 6*a(n-1)-13*a(n-2)+12*a(n-3)-4*a(n-4) for n>5
G.f.: (1-3*x+5*x^2-3*x^3-4*x^4+3*x^5) / ((1-x)^2*(1-2*x)^2).
(End)
MATHEMATICA
Join[{1, 3}, Table[7(n+2)2^(n-3)-n-2, {n, 2, 30}]] (* or *) LinearRecurrence[ {6, -13, 12, -4}, {1, 3, 10, 30, 78, 189}, 30] (* Harvey P. Dale, Oct 31 2015 *)
PROG
(PARI) Vec((1-3*x+5*x^2-3*x^3-4*x^4+3*x^5)/((1-x)^2*(1-2*x)^2) + O(x^40)) \\ Colin Barker, Feb 18 2016
(Magma) [n le 1 select 2*n+1 else 7*(n+2)*2^(n-3) - n - 2: n in [0..40]]; // G. C. Greubel, Jun 16 2024
(SageMath) [7*(n+2)*2^(n-3) - n - 2 + (5/4)*int(n==0) + (3/4)*int(n==1) for n in range(41)] # G. C. Greubel, Jun 16 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved