login
A158459
Period 4: repeat [0, 3, 2, 1].
4
0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2
OFFSET
0,2
FORMULA
G.f.: x*(x^2+2*x+3)/(1-x^4).
a(n) = A102370(n) (mod 4).
a(n) = 3/2-(-1)^n/2+sin(n*Pi/2)-cos(n*Pi/2). - Richard Choulet, Apr 07 2009
a(n) = -n (mod 4). - M. F. Hasler, Jan 13 2012; formula simplified by Arkadiusz Wesolowski, Jul 03 2012
a(n) = (3-(-1)^n-2*I^(n*(n+1)))/2. - Bruno Berselli, Jul 03 2012
a(n) = floor(107/3333*10^(n+1)) mod 10. - Hieronymus Fischer, Jan 04 2013
a(n) = floor(19/85*4^(n+1)) mod 4. - Hieronymus Fischer, Jan 04 2013
a(n) = ((n+1) mod 4)+(-1)^((n+1) mod 4). - Wesley Ivan Hurt, May 18 2014
a(n) = 3*n mod 4. - Gary Detlefs, May 24 2014
a(n) = a(n-4) for n>3. - Wesley Ivan Hurt, Jul 09 2016
MAPLE
seq(op([0, 3, 2, 1]), n=0..50); # Wesley Ivan Hurt, Jul 09 2016
MATHEMATICA
Flatten@Table[{0, 3, 2, 1}, {22}] (* Arkadiusz Wesolowski, Jul 03 2012 *)
PROG
(PARI) A158459(n)=(-n)%4 \\ M. F. Hasler, Jan 13 2012
(Haskell)
a158459 = (`mod` 4) . negate
a158459_list = cycle [0, 3, 2, 1] -- Reinhard Zumkeller, Feb 22 2013
(Magma) &cat [[0, 3, 2, 1]^^30]; // Wesley Ivan Hurt, Jul 09 2016
CROSSREFS
Sequence in context: A359677 A215486 A083721 * A319666 A307333 A031251
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Mar 19 2009
EXTENSIONS
Better definition from M. F. Hasler, Jan 13 2012
STATUS
approved