login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A087204 Period 6: repeat [2, 1, -1, -2, -1, 1]. 14

%I #72 Dec 14 2023 05:12:13

%S 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,

%T -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,

%U 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

%N Period 6: repeat [2, 1, -1, -2, -1, 1].

%C Satisfies (a(n))^2 = a(2n) + 2. Shifted differences of itself.

%C Moebius transform is length 6 sequence [1, -2, -3, 0, 0, 6]. - _Michael Somos_, Oct 22 2006

%C 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

%D A. T. Benjamin and J. J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A. 2003, id. 176.

%H Tanya Khovanova, <a href="http://www.tanyakhovanova.com/RecursiveSequences/RecursiveSequences.html">Recursive Sequences</a>.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lucas_sequence#Specific_names">Lucas sequence</a>.

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1).

%H <a href="/index/Rea#recur1">Index entries for recurrences a(n) = k*a(n - 1) +/- a(n - 2)</a>.

%F a(n) = a(n-1) - a(n-2), starting with a(0) = 2 and a(1) = 1.

%F G.f.: (2-x)/(1-x+x^2).

%F a(n) = Sum_{k>=0} (-1)^k*n/(n-k)*C(n-k, k).

%F a(n) = (1/2)*((-1)^floor(n/3) + 2*(-1)^floor((n+1)/3) + (-1)^floor((n+2)/3)).

%F Multiplicative with a(2^e) = -1, a(3^e) = -2, a(p^e) = 1 otherwise. - _David W. Wilson_, Jun 12 2005

%F a(n) = a(-n) = -a(n-3) for all n in Z. - _Michael Somos_, Oct 22 2006

%F E.g.f.: 2*exp(x/2)*cos(sqrt(3)*x/2). - _Sergei N. Gladkovskii_, Aug 12 2012

%F 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

%F a(n) = 2*cos(n*Pi/3). - _Wesley Ivan Hurt_, Jun 19 2016

%F Dirichlet g.f.: zeta(s)*(1-2^(1-s)-3^(1-s)+6^(1-s)). - _Amiram Eldar_, Jan 01 2023

%e 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.

%e 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 + ...

%p A087204:=n->[2, 1, -1, -2, -1, 1][(n mod 6)+1]: seq(A087204(n), n=0..100); # _Wesley Ivan Hurt_, Jun 19 2016

%t PadLeft[{}, 108, {2,1,-1,-2,-1,1}] (* _Harvey P. Dale_, Sep 11 2011 *)

%t a[ n_] := {1, -1, -2, -1, 1, 2}[[Mod[n, 6, 1]]]; (* _Michael Somos_, Jan 29 2015 *)

%t a[ n_] := 2 Re[ Exp[ Pi I n / 3]]; (* _Michael Somos_, Mar 29 2015 *)

%o (PARI) {a(n) = [2, 1, -1, -2, -1, 1][n%6 + 1]}; /* _Michael Somos_, Oct 22 2006 */

%o (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

%o (Sage) [lucas_number2(n,1,1) for n in range(0, 102)] # _Zerinvary Lajos_, Apr 30 2009

%o (Magma) &cat[[2, 1, -1, -2, -1, 1]^^20]; // _Wesley Ivan Hurt_, Jun 19 2016

%Y Essentially the same as A057079 and A100051. Pairwise sums of A010892.

%Y Cf. A128834.

%K sign,easy,mult

%O 0,1

%A Nikolay V. Kosinov (kosinov(AT)unitron.com.ua), Oct 19 2003

%E Edited by _Ralf Stephan_, Feb 04 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)