OFFSET
1,2
COMMENTS
Partial sums of A255465. - Klaus Purath, Mar 18 2021
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Eric Weisstein's World of Mathematics, Rule 190
Index entries for linear recurrences with constant coefficients, signature (4,1,-4).
FORMULA
G.f.: x*(1+3*x)/((1-x)*(1-4*x)*(1+x)). - Vincenzo Librandi, Jun 22 2012
a(n) = 4*a(n-1) + a(n-2) - 4*a(n-3). - Vincenzo Librandi, Jun 22 2012
a(n) = (7*4^n + 3*(-1)^n - 10)/15. - Bruno Berselli, Jun 22 2012, corrected by Klaus Purath, Mar 18 2021.
a(n) = floor(7*4^n/15). - Karl V. Keller, Jr., Mar 09 2021
From Klaus Purath, Mar 18 2021: (Start)
a(n) = 16*a(n-2) - 3*(-1)^n + 10, assuming that a(0) = 0.
a(n) = 4*a(n-1) + 2 + (-1)^n.
a(n) = 5*a(n-1) - 4*a(n-2) + 2*(-1)^n, n > 2. (End)
MATHEMATICA
CoefficientList[Series[(1+3*x)/((x-1)*(4*x-1)*(1+x)), {x, 0, 30}], x] (*or*) LinearRecurrence[{4, 1, -4}, {1, 7, 29}, 40] (* Vincenzo Librandi, Jun 22 2012 *)
PROG
(Magma) I:=[1, 7, 29]; [n le 3 select I[n] else 4*Self(n-1)+Self(n-2)-4*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Jun 22 2012
(PARI) my(x='x+O('x^99)); Vec(x*(1+3*x)/((1-x)*(1-4*x)*(1+x))) \\ Altug Alkan, Sep 21 2018
(Python) print([7*4**n//15 for n in range(1, 30)]) # Karl V. Keller, Jr., Mar 09 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved