login
A087204
Period 6: repeat [2, 1, -1, -2, -1, 1].
14
2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1
OFFSET
0,1
COMMENTS
Satisfies (a(n))^2 = a(2n) + 2. Shifted differences of itself.
Moebius transform is length 6 sequence [1, -2, -3, 0, 0, 6]. - Michael Somos, Oct 22 2006
Twice the real part of x^n, where x is either of the primitive 6th roots of unity. For the root with positive imaginary part, the imaginary part of x^n is i*A128834(n)*sqrt(3)/2. - Peter Munn, Apr 25 2022
REFERENCES
A. T. Benjamin and J. J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A. 2003, id. 176.
FORMULA
a(n) = a(n-1) - a(n-2), starting with a(0) = 2 and a(1) = 1.
G.f.: (2-x)/(1-x+x^2).
a(n) = Sum_{k>=0} (-1)^k*n/(n-k)*C(n-k, k).
a(n) = (1/2)*((-1)^floor(n/3) + 2*(-1)^floor((n+1)/3) + (-1)^floor((n+2)/3)).
Multiplicative with a(2^e) = -1, a(3^e) = -2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 12 2005
a(n) = a(-n) = -a(n-3) for all n in Z. - Michael Somos, Oct 22 2006
E.g.f.: 2*exp(x/2)*cos(sqrt(3)*x/2). - Sergei N. Gladkovskii, Aug 12 2012
a(n) = r^n + s^n, with r=(1+i*sqrt(3))/2 and s=(1-i*sqrt(3))/2 the roots of 1-x+x^2. - Ralf Stephan, Jul 19 2013
a(n) = 2*cos(n*Pi/3). - Wesley Ivan Hurt, Jun 19 2016
Dirichlet g.f.: zeta(s)*(1-2^(1-s)-3^(1-s)+6^(1-s)). - Amiram Eldar, Jan 01 2023
EXAMPLE
a(2) = -1 = a(1) - a(0) = 1 - 2 = ((1+sqrt(-3))/2)^2 + ((1-sqrt(-3))/2)^2 = -1 = -2/4 + 2*sqrt(-3)/4 - 2/4 -2 sqrt(-3)/4 = -1.
G.f. = 2 + x - x^2 - 2*x^3 - x^4 + x^5 + 2*x^6 + x^7 - x^8 - 2*x^9 - x^10 + ...
MAPLE
A087204:=n->[2, 1, -1, -2, -1, 1][(n mod 6)+1]: seq(A087204(n), n=0..100); # Wesley Ivan Hurt, Jun 19 2016
MATHEMATICA
PadLeft[{}, 108, {2, 1, -1, -2, -1, 1}] (* Harvey P. Dale, Sep 11 2011 *)
a[ n_] := {1, -1, -2, -1, 1, 2}[[Mod[n, 6, 1]]]; (* Michael Somos, Jan 29 2015 *)
a[ n_] := 2 Re[ Exp[ Pi I n / 3]]; (* Michael Somos, Mar 29 2015 *)
PROG
(PARI) {a(n) = [2, 1, -1, -2, -1, 1][n%6 + 1]}; /* Michael Somos, Oct 22 2006 */
(PARI) A087204(n) = if(0==n, 2, my(f = factor(n)); prod(k=1, #f~, if(f[k, 1]<=3, 1-f[k, 1], 1))); \\ (After David W. Wilson's multiplicative formula) - Antti Karttunen, Apr 28 2022
(Sage) [lucas_number2(n, 1, 1) for n in range(0, 102)] # Zerinvary Lajos, Apr 30 2009
(Magma) &cat[[2, 1, -1, -2, -1, 1]^^20]; // Wesley Ivan Hurt, Jun 19 2016
CROSSREFS
Essentially the same as A057079 and A100051. Pairwise sums of A010892.
Cf. A128834.
Sequence in context: A131556 A107751 A132367 * A101825 A177702 A131534
KEYWORD
sign,easy,mult
AUTHOR
Nikolay V. Kosinov (kosinov(AT)unitron.com.ua), Oct 19 2003
EXTENSIONS
Edited by Ralf Stephan, Feb 04 2005
STATUS
approved