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.
%I A087204 #76 Aug 09 2025 08:13:55 %S A087204 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 A087204 -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 A087204 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 A087204 Period 6: repeat [2, 1, -1, -2, -1, 1]. %C A087204 Satisfies (a(n))^2 = a(2n) + 2. Shifted differences of itself. %C A087204 Moebius transform is length 6 sequence [1, -2, -3, 0, 0, 6]. - _Michael Somos_, Oct 22 2006 %C A087204 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 A087204 A. T. Benjamin and J. J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A. 2003, id. 176. %D A087204 Paulo Ribenboim, My Numbers, My Friends: Popular Lectures on Number Theory, Springer-Verlag, NY, 2000, p. 6. %H A087204 Tanya Khovanova, <a href="http://www.tanyakhovanova.com/RecursiveSequences/RecursiveSequences.html">Recursive Sequences</a>. %H A087204 Wikipedia, <a href="http://en.wikipedia.org/wiki/Lucas_sequence#Specific_names">Lucas sequence</a>. %H A087204 <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1). %H A087204 <a href="/index/Rea#recur1">Index entries for recurrences a(n) = k*a(n - 1) +/- a(n - 2)</a>. %F A087204 a(n) = a(n-1) - a(n-2), starting with a(0) = 2 and a(1) = 1. %F A087204 G.f.: (2-x)/(1-x+x^2). %F A087204 a(n) = Sum_{k>=0} (-1)^k*n/(n-k)*C(n-k, k). %F A087204 a(n) = (1/2)*((-1)^floor(n/3) + 2*(-1)^floor((n+1)/3) + (-1)^floor((n+2)/3)). %F A087204 Multiplicative with a(2^e) = -1, a(3^e) = -2, a(p^e) = 1 otherwise. - _David W. Wilson_, Jun 12 2005 %F A087204 a(n) = a(-n) = -a(n-3) for all n in Z. - _Michael Somos_, Oct 22 2006 %F A087204 E.g.f.: 2*exp(x/2)*cos(sqrt(3)*x/2). - _Sergei N. Gladkovskii_, Aug 12 2012 %F A087204 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 A087204 a(n) = 2*cos(n*Pi/3). - _Wesley Ivan Hurt_, Jun 19 2016 %F A087204 Dirichlet g.f.: zeta(s)*(1-2^(1-s)-3^(1-s)+6^(1-s)). - _Amiram Eldar_, Jan 01 2023 %e A087204 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 A087204 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 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 A087204 PadLeft[{}, 108, {2,1,-1,-2,-1,1}] (* _Harvey P. Dale_, Sep 11 2011 *) %t A087204 a[ n_] := {1, -1, -2, -1, 1, 2}[[Mod[n, 6, 1]]]; (* _Michael Somos_, Jan 29 2015 *) %t A087204 a[ n_] := 2 Re[ Exp[ Pi I n / 3]]; (* _Michael Somos_, Mar 29 2015 *) %o A087204 (PARI) {a(n) = [2, 1, -1, -2, -1, 1][n%6 + 1]}; /* _Michael Somos_, Oct 22 2006 */ %o A087204 (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 A087204 (Sage) [lucas_number2(n,1,1) for n in range(0, 102)] # _Zerinvary Lajos_, Apr 30 2009 %o A087204 (Magma) &cat[[2, 1, -1, -2, -1, 1]^^20]; // _Wesley Ivan Hurt_, Jun 19 2016 %Y A087204 Essentially the same as A057079 and A100051. Pairwise sums of A010892. %Y A087204 Cf. A128834. %K A087204 sign,easy,mult %O A087204 0,1 %A A087204 Nikolay V. Kosinov (kosinov(AT)unitron.com.ua), Oct 19 2003 %E A087204 Edited by _Ralf Stephan_, Feb 04 2005