A130658 Period 4: repeat [1, 1, 2, 2].
1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1,-1,1).
Programs
-
Haskell
a130658 = (+ 1) . (`div` 2) . (`mod` 4) a130658_list = cycle [1,1,2,2] -- Reinhard Zumkeller, Jul 06 2012
-
Magma
&cat [[1, 1, 2, 2]^^30]; // Wesley Ivan Hurt, Jul 11 2016
-
Maple
seq(op([1, 1, 2, 2]), n=0..50); # Wesley Ivan Hurt, Jul 11 2016
-
Mathematica
PadRight[{}, 100, {1, 1, 2, 2}] (* Wesley Ivan Hurt, Jul 11 2016 *)
-
PARI
a(n)=(n%4>1)+1 \\ Charles R Greathouse IV, Jul 11 2016
Formula
G.f.: ( 1+2*x^2 ) / ( (1-x)*(1+x^2) ). - R. J. Mathar, Jan 18 2011
a(n) = (n^3 mod 4 + (n+1)^3 mod 4 + 1)/2. - Gary Detlefs, Apr 15 2011
a(n) = -1/2*cos(1/2*Pi*n)-1/2*sin(1/2*Pi*n)+3/2. - Leonid Bedratyuk, May 13 2012
From Wesley Ivan Hurt, May 30 2015: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3), n>3.
a(n) = (3+(-1)^((2*n+3+(-1)^n)/4))/2. (End)
From Wesley Ivan Hurt, Jul 11 2016: (Start)
a(n) = a(n-4) for n>3.
a(n) = A021913(n) + 1. (End)
Extensions
More terms from Klaus Brockhaus, May 14 2010
Comments