A010882 Period 3: repeat [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, 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, 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
Offset: 0
Links
Crossrefs
Programs
-
Haskell
a010882 = (+ 1) . (`mod` 3) a010882_list = cycle [1,2,3] -- Reinhard Zumkeller, Mar 20 2013
-
Magma
&cat[[1..3]^^30]; // Vincenzo Librandi, Feb 04 2016
-
Maple
seq(op([1, 2, 3]), n=0..50); # Wesley Ivan Hurt, Jul 05 2016
-
Mathematica
Nest[ Flatten[ # /. {1 -> {1, 2}, 2 -> {3, 1}, 3 -> {2, 3}}] &, {1}, 7] (* Robert G. Wilson v, Mar 08 2005 *) PadRight[{},120,{1,2,3}] (* Harvey P. Dale, Apr 09 2018 *)
-
PARI
a(n) = 1 + n%3; \\ Michel Marcus, Feb 04 2016
Formula
G.f.: (1+2x+3x^2)/(1-x^3). - Paul Barry, May 25 2003
a(n) = 1 + (n mod 3). - Paolo P. Lava, Nov 21 2006
a(n) = A010872(n) + 1. - Hieronymus Fischer, Jun 08 2007
a(n) = 6 - a(n-1) - a(n-2) for n > 1. - Reinhard Zumkeller, Apr 13 2008
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
a(n) = A180593(n+1)/3. - Reinhard Zumkeller, Oct 25 2010
a(n) = floor((4*n+3)/3) mod 4. - Gary Detlefs, May 15 2011
a(n) = -cos(2/3*Pi*n)-1/3*3^(1/2)*sin(2/3*Pi*n)+2. - Leonid Bedratyuk, May 13 2012
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
Comments