login
A033121
Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,1.
1
1, 3, 10, 31, 93, 280, 841, 2523, 7570, 22711, 68133, 204400, 613201, 1839603, 5518810, 16556431, 49669293, 149007880, 447023641, 1341070923, 4023212770, 12069638311, 36208914933, 108626744800, 325880234401, 977640703203, 2932922109610, 8798766328831
OFFSET
1,2
FORMULA
a(n) = 3*a(n-1) + a(n-3) - 3*a(n-4).
G.f.: x*(1+x^2) / ((1-x)*(1-3*x)*(1+x+x^2)). - Colin Barker, Dec 24 2015
MATHEMATICA
Table[FromDigits[PadRight[{}, n, {1, 0, 1}], 3], {n, 30}] (* or *) LinearRecurrence[ {3, 0, 1, -3}, {1, 3, 10, 31}, 30] (* Harvey P. Dale, Jan 20 2017 *)
PROG
(PARI) Vec(x*(1+x^2)/((1-x)*(1-3*x)*(1+x+x^2)) + O(x^30)) \\ Colin Barker, Dec 24 2015
CROSSREFS
Sequence in context: A212031 A339032 A374925 * A180432 A237930 A192337
KEYWORD
nonn,base,easy
STATUS
approved