login
Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,1.
1

%I #16 Jan 20 2017 11:36:58

%S 1,3,10,31,93,280,841,2523,7570,22711,68133,204400,613201,1839603,

%T 5518810,16556431,49669293,149007880,447023641,1341070923,4023212770,

%U 12069638311,36208914933,108626744800,325880234401,977640703203,2932922109610,8798766328831

%N Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,1.

%H Colin Barker, <a href="/A033121/b033121.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^2) / ((1-x)*(1-3*x)*(1+x+x^2)). - _Colin Barker_, Dec 24 2015

%t 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 *)

%o (PARI) Vec(x*(1+x^2)/((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_