%I #33 Oct 09 2024 15:36:16
%S 0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,
%T 1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,
%U 3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3
%N Period 3: repeat [0, 1, 3].
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).
%F a(n) = floor((n mod 3)*3/2). - _Reinhard Zumkeller_, Jun 23 2007
%F a(n) = 4 - a(n-1) - a(n-2) for n > 1. - _Reinhard Zumkeller_, Apr 13 2008
%F G.f.: x*(1+3*x)/(1-x^3). - _Jaume Oliver Lafont_, Mar 24 2009
%F a(n) = 2^(n mod 3) - 1. - _Wesley Ivan Hurt_, Apr 16 2014
%F a(n) = (7*a(n-1) + 2)*(3 - a(n-1))/6 for n > 0. - _Nicolas Bělohoubek_, Oct 09 2024
%p A101000:=n->2^(n mod 3) - 1; seq(A101000(n), n=0..100); # _Wesley Ivan Hurt_, Apr 16 2014
%t PadRight[{},120,{0,1,3}] (* _Harvey P. Dale_, Apr 28 2012 *)
%t Table[2^Mod[n, 3] - 1, {n, 0, 100}] (* _Wesley Ivan Hurt_, Apr 16 2014 *)
%o (PARI) a(n)=n%3+(n%3==2) \\ _Jaume Oliver Lafont_, Mar 24 2009
%o (PARI) a(n)=2^(n%3)-1 \\ _Jaume Oliver Lafont_, Mar 24 2009
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_, Jun 17 2007