login
A037496
Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,2.
3
1, 3, 11, 34, 102, 308, 925, 2775, 8327, 24982, 74946, 224840, 674521, 2023563, 6070691, 18212074, 54636222, 163908668, 491726005, 1475178015, 4425534047, 13276602142, 39829806426, 119489419280, 358468257841, 1075404773523
OFFSET
1,2
FORMULA
a(n) = 3*a(n-1) + a(n-3) - 3*a(n-4).
From Bruno Berselli, Jan 20 2011: (Start)
G.f.: x*(1+2*x^2)/((1-x)*(1-3*x)*(1+x+x^2)).
a(n) = round((11*3^n-13)/26) = (11*3^n-13)/26 + ((3-7*i*sqrt(3))*(-1+i*sqrt(3))^n + (3+7*i*sqrt(3))*(-1-i*sqrt(3))^n)/(78*2^n) where i is the imaginary unit. (End)
MATHEMATICA
With[{c=PadRight[{}, 30, {1, 0, 2}]}, Table[FromDigits[Take[c, n], 3], {n, 30}]] (* or *) LinearRecurrence[{3, 0, 1, -3}, {1, 3, 11, 34}, 30] (* Harvey P. Dale, Mar 30 2012 *)
PROG
(Magma) I:=[1, 3, 11, 34]; [n le 4 select I[n] else 3*Self(n-1) +Self(n-3)-3*Self(n-4): n in [1..30]]; // Vincenzo Librandi, Nov 26 2016
CROSSREFS
Sequence in context: A084266 A357592 A052471 * A355364 A180762 A134326
KEYWORD
nonn,base,easy
STATUS
approved