login
A037497
Base-4 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,2.
2
1, 4, 18, 73, 292, 1170, 4681, 18724, 74898, 299593, 1198372, 4793490, 19173961, 76695844, 306783378, 1227133513, 4908534052, 19634136210, 78536544841, 314146179364, 1256584717458, 5026338869833, 20105355479332, 80421421917330
OFFSET
1,2
FORMULA
From Vincenzo Librandi, Jun 22 2012: (Start)
G.f.: x*(1+2*x^2)/((1-x)*(1-4*x)*(1+x+x^2)).
a(n) = 4*a(n-1) + a(n-3) - 4*a(n-4). (End)
a(n) = floor(2*4^n/7). - Karl V. Keller, Jr., Sep 22 2020
MATHEMATICA
LinearRecurrence[{4, 0, 1, -4}, {1, 4, 18, 73}, 40] (* or *) CoefficientList[Series[(1 + 2 x^2)/((1 - x)(1 - 4 x) (1 + x + x^2)), {x, 0, 40}], x] (* Vincenzo Librandi, Jun 22 2012 *)
PROG
(Magma) I:=[1, 4, 18, 73]; [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 22 2012
(Python) print([2*4**n//7 for n in range(1, 25)]) # Karl V. Keller, Jr., Sep 22 2020
CROSSREFS
KEYWORD
nonn,base,easy
STATUS
approved