%I #62 Sep 08 2022 08:44:37
%S 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,
%T 2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,
%U 3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3
%N Period 3: repeat [1, 2, 3].
%C Partial sums are given by A130481(n)+n+1. - _Hieronymus Fischer_, Jun 08 2007
%C 41/333 = 0.123123123... - _Eric Desbiaux_, Nov 03 2008
%C Terms of the simple continued fraction for 3/(sqrt(37)-4). - _Paolo P. Lava_, Feb 16 2009
%C This is the lexicographically earliest sequence with no substring of more than 1 term being a palindrome. - _Franklin T. Adams-Watters_, Nov 24 2013
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F G.f.: (1+2x+3x^2)/(1-x^3). - _Paul Barry_, May 25 2003
%F a(n) = 1 + (n mod 3). - _Paolo P. Lava_, Nov 21 2006
%F a(n) = A010872(n) + 1. - _Hieronymus Fischer_, Jun 08 2007
%F a(n) = 6 - a(n-1) - a(n-2) for n > 1. - _Reinhard Zumkeller_, Apr 13 2008
%F a(n) = n+1-3*floor(n/3) = floor(41*10^(n+1)/333)-floor(41*10^n/333)*10; a(n)-a(n-3)=0 with n>2. - _Bruno Berselli_, Jun 28 2010
%F a(n) = A180593(n+1)/3. - _Reinhard Zumkeller_, Oct 25 2010
%F a(n) = floor((4*n+3)/3) mod 4. - _Gary Detlefs_, May 15 2011
%F a(n) = -cos(2/3*Pi*n)-1/3*3^(1/2)*sin(2/3*Pi*n)+2. - _Leonid Bedratyuk_, May 13 2012
%F E.g.f.: 2*(3*exp(3*x/2) - sqrt(3)*cos(Pi/6-sqrt(3)*x/2))*exp(-x/2)/3. - _Ilya Gutkovskiy_, Jul 05 2016
%p seq(op([1, 2, 3]), n=0..50); # _Wesley Ivan Hurt_, Jul 05 2016
%t Nest[ Flatten[ # /. {1 -> {1, 2}, 2 -> {3, 1}, 3 -> {2, 3}}] &, {1}, 7] (* _Robert G. Wilson v_, Mar 08 2005 *)
%t PadRight[{},120,{1,2,3}] (* _Harvey P. Dale_, Apr 09 2018 *)
%o (Haskell)
%o a010882 = (+ 1) . (`mod` 3)
%o a010882_list = cycle [1,2,3]
%o -- _Reinhard Zumkeller_, Mar 20 2013
%o (PARI) a(n) = 1 + n%3; \\ _Michel Marcus_, Feb 04 2016
%o (Magma) &cat[[1..3]^^30]; // _Vincenzo Librandi_, Feb 04 2016
%Y Cf. A010872, A010873, A010874, A010875, A010876, A004526, A002264, A002265, A002266, A177036 (decimal expansion of (4+sqrt(37))/7), A214090.
%Y Cf. A130481, A180593.
%K nonn,easy
%O 0,2
%A _N. J. A. Sloane_