cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A186809 Period 6 sequence [0, 1, 2, 0, -2, -1, ...].

Original entry on oeis.org

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

Views

Author

Michael Somos, Feb 26 2011

Keywords

Comments

For n > 0: a(n) = A262565(n+1) - A262565(n). - Reinhard Zumkeller, Oct 19 2015

Examples

			G.f. = x + 2*x^2 - 2*x^4 - x^5 + x^7 + 2*x^8 - 2*x^10 - x^11 + x^13 + ...
		

Crossrefs

Cf. A193680.
Cf. A262565.

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