Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #15 Dec 24 2015 13:39:32
%S 1,4,12,37,112,336,1009,3028,9084,27253,81760,245280,735841,2207524,
%T 6622572,19867717,59603152,178809456,536428369,1609285108,4827855324,
%U 14483565973,43450697920,130352093760,391056281281,1173168843844,3519506531532,10558519594597
%N Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,1,0.
%H Colin Barker, <a href="/A033130/b033130.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (3,0,1,-3).
%F a(n) = 3*a(n-1) + a(n-3) - 3*a(n-4).
%F G.f.: x*(1+x) / ((1-x)*(1-3*x)*(1+x+x^2)). - _Colin Barker_, Dec 24 2015
%t Module[{nn=30,c},c=PadRight[{},nn,{1,1,0}];Table[FromDigits[Take[c,n],3],{n,nn}]] (* or *) LinearRecurrence[{3,0,1,-3},{1,4,12,37},30] (* _Harvey P. Dale_, Sep 01 2015 *)
%o (PARI) Vec(x*(1+x)/((1-x)*(1-3*x)*(1+x+x^2)) + O(x^30)) \\ _Colin Barker_, Dec 24 2015
%K nonn,base,easy
%O 1,2
%A _Clark Kimberling_