OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (4,0,1,-4).
FORMULA
G.f.: x*(2+x+2*x^2) / ((x-1)*(4*x-1)*(1+x+x^2)). - R. J. Mathar, Nov 21 2011
a(n) = 4*(n-1) + a(n-3) - 4*a(n-4). - Vincenzo Librandi, Jun 17 2012
a(n) = floor(38*4^n/63). - Christian Krause, Jun 05 2026
MATHEMATICA
With[{c=PadRight[{}, 30, {2, 1, 2}]}, Table[FromDigits[Take[c, n], 4], {n, 30}]] (* Harvey P. Dale, Nov 06 2011 *)
LinearRecurrence[{4, 0, 1, -4}, {2, 9, 38, 154}, 40] (* Vincenzo Librandi, Jun 17 2012 *)
PROG
(Magma) I:=[2, 9, 38, 154]; [n le 4 select I[n] else 4*Self(n-1)+Self(n-3)-4*Self(n-4): n in [1..30]]; // Vincenzo Librandi, Jun 17 2012
(PARI) a(n)=([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; -4, 1, 0, 4]^(n-1)*[2; 9; 38; 154])[1, 1] \\ Charles R Greathouse IV, Jun 02 2026
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
EXTENSIONS
a(24)-a(27) from Christian Krause, Jun 05 2026
STATUS
approved
