A186809 Period 6 sequence [0, 1, 2, 0, -2, -1, ...].
0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0, 1, 2, 0, -2, -1, 0
Offset: 0
Examples
G.f. = x + 2*x^2 - 2*x^4 - x^5 + x^7 + 2*x^8 - 2*x^10 - x^11 + x^13 + ...
Links
- Michael Somos, Rational Function Multiplicative Coefficients
- Index entries for linear recurrences with constant coefficients, signature (0,-1,0,-1)
Programs
-
Haskell
a186809 n = a186809_list !! (n-1) a186809_list = cycle [0, 1, 2, 0, -2, -1] -- Reinhard Zumkeller, Oct 19 2015
-
Magma
[(((n+1) mod 3)-1)*(((n+1) mod 2)+1)*(-1)^(n+1) : n in [0..100]]; // Wesley Ivan Hurt, Aug 31 2014
-
Maple
A186809:=n->(((n+1) mod 3)-1)*(((n+1) mod 2)+1)*(-1)^(n+1): seq(A186809(n), n=0..100); # Wesley Ivan Hurt, Aug 31 2014
-
Mathematica
Table[(Mod[n + 1, 3] - 1) (Mod[n + 1, 2] + 1) (-1)^(n + 1), {n, 0, 100}] (* Wesley Ivan Hurt, Aug 31 2014 *) PadRight[{},120,{0,1,2,0,-2,-1}] (* Harvey P. Dale, Nov 18 2020 *)
-
PARI
{a(n) = [0, 1, 2, 0, -2, -1][n%6 + 1]};
Formula
Euler transform of length 6 sequence [2, -3, 0, 0, 0, 1].
a(n) is multiplicative with a(2^e) = -2 * (-1)^e if e>0. a(3^e) = 0^e, a(p^e) = 1 if p == 1 (mod 6), a(p^e) = (-1)^n if p == 5 (mod 6).
G.f.: x * (1 + x)^2 / (1 + x^2 + x^4). a(n+3) = a(-n) = -a(n). a(n) = n if |n| < 3.
a(n) = (mod(n+1, 3) - 1) * (mod(n+1, 2) + 1) * (-1)^(n+1). - Wesley Ivan Hurt, Aug 31 2014
|a(n)| = A193680(n). - Wesley Ivan Hurt, Aug 31 2014
Comments