A057079 Periodic sequence: repeat [1,2,1,-1,-2,-1]; expansion of (1+x)/(1-x+x^2).
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
Offset: 0
Examples
G.f. = 1 + 2*x + x^2 - x^3 - 2*x^4 - x^5 + x^6 + 2*x^7 + x^8 - x^9 - 2*x^10 + x^11 + ...
Links
- Alex Fink, Richard K. Guy, and Mark Krusemeyer, Partitions with parts occurring at most thrice, Contributions to Discrete Mathematics, Vol 3, No 2 (2008), pp. 76-114. See Section 13.
- T.-X. He and L. W. Shapiro, Fuss-Catalan matrices, their weighted sums, and stabilizer subgroups of the Riordan group, Lin. Alg. Applic. 532 (2017) 25-41, theorem 2.5, k=3.
- Tanya Khovanova, Recursive Sequences
- Index entries for linear recurrences with constant coefficients, signature (1,-1).
- Index entries for recurrences a(n) = k*a(n - 1) +/- a(n - 2)
- Index entries for sequences related to Chebyshev polynomials.
Programs
-
Maple
A057079:=n->[1, 2, 1, -1, -2, -1][(n mod 6)+1]: seq(A057079(n), n=0..100); # Wesley Ivan Hurt, Mar 10 2015
-
Mathematica
a[n_] := {1, 2, 1, -1, -2, -1}[[Mod[n, 6] + 1]]; Array[a, 100, 0] (* Jean-François Alcover, Jul 05 2013 *) CoefficientList[Series[(1 + x)/(1 - x + x^2), {x, 0, 71}], x] (* Michael De Vlieger, Jul 10 2017 *) PadRight[{},100,{1,2,1,-1,-2,-1}] (* Harvey P. Dale, Nov 11 2024 *)
-
PARI
{a(n) = [1, 2, 1, -1, -2, -1][n%6 + 1]}; /* Michael Somos, Jul 14 2006 */
-
PARI
{a(n) = if( n<0, n = 2-n); polcoeff( (1 + x) / (1 - x + x^2) + x * O(x^n), n)}; /* Michael Somos, Jul 14 2006 */
-
PARI
a(n)=2^(n%3%2)*(-1)^(n\3) \\ Tani Akinari, Aug 15 2013
Formula
a(n) = S(n, 1) + S(n-1, 1) = S(2*n, sqrt(3)); S(n, x) := U(n, x/2), Chebyshev polynomials of 2nd kind, A049310. S(n, 1) = A010892(n).
a(n) = 2*cos((n-1)*Pi/3) = a(n-1) - a(n-2) = -a(n-3) = a(n-6) = (A022003(n+1)+1)*(-1)^floor(n/3). Unsigned a(n) = 4 - a(n-1) - a(n-2). - Henry Bottomley, Mar 29 2001
a(n) = (-1)^floor(n/3) + ((-1)^floor((n-1)/3) + (-1)^floor((n+1)/3))/2. - Mario Catalani (mario.catalani(AT)unito.it), Jan 07 2003
a(n) = (1/2 - sqrt(3)*i/2)^(n-1) + (1/2 + sqrt(3)*i/2)^(n-1) = cos(Pi*n/3) + sqrt(3)*sin(Pi*n/3). - Paul Barry, Mar 15 2004
The period 3 sequence (2, -1, -1, ...) has a(n) = 2*cos(2*Pi*n/3) = (-1/2 - sqrt(3)*i/2)^n + (-1/2 + sqrt(3)*i/2)^n. - Paul Barry, Mar 15 2004
Euler transform of length 6 sequence [2, -2, -1, 0, 0, 1]. - Michael Somos, Jul 14 2006
G.f.: (1 + x) / (1 - x + x^2) = (1 - x^2)^2 * (1 - x^3) / ((1 - x)^2 * (1 - x^6)). a(n) = a(2-n) for all n in Z. - Michael Somos, Jul 14 2006
a(n) = (-1)^floor(n/3)*((n mod 3) mod 2 + 1). - Hieronymus Fischer, Jun 20 2007
a(n) = (3*(-1)^floor(n/3) - (-1)^n)/2. - Hieronymus Fischer, Jun 20 2007
a(n) = (-1)^((n-1)/3) + (-1)^((1-n)/3). - Jaume Oliver Lafont, May 13 2010
E.g.f.: E(x) = S(0), S(k) = 1 + 2*x/(6*k+1 - x*(6*k+1)/(4*(3*k+1) + x + 4*x*(3*k+1)/(6*k + 3 - x - x*(6*k+3)/(3*k + 2 + x - x*(3*k+2)/(12*k + 10 + x - x*(12*k+10)/(x - (6*k+6)/S(k+1))))))); (continued fraction). - Sergei N. Gladkovskii, Dec 14 2011
a(n) = -2 + floor((281/819)*10^(n+1)) mod 10. - Hieronymus Fischer, Jan 04 2013
a(n) = -2 + floor((11/14)*5^(n+1)) mod 5. - Hieronymus Fischer, Jan 04 2013
a(n) = ( (1+i*sqrt(3))^(n-1) + (1-i*sqrt(3))^(n-1) )/2^(n-1), where i=sqrt(-1). - Bruno Berselli, Dec 01 2014
a(n) = 2*sin((2n+1)*Pi/6). - Wesley Ivan Hurt, Apr 04 2015
a(n) = hypergeom([-n/2-2, -n/2-5/2], [-n-4], 4). - Peter Luschny, Dec 17 2016
G.f.: 1 / (1 - 2*x / (1 + 3*x / (2 - x))). - Michael Somos, Dec 29 2016
a(n) = (2*n+1)*(Sum_{k=0..n} ((-1)^k/(2*k+1))*binomial(n+k,2*k)) for n >= 0. - Werner Schulte, Jul 10 2017
Sum_{n>=0} (a(n)/(2*n+1))*x^(2*n+1) = arctan(x/(1-x^2)) for -1 < x < 1. - Werner Schulte, Jul 10 2017
E.g.f.: exp(x/2)*(sqrt(3)*cos(sqrt(3)*x/2) + 3*sin(sqrt(3)*x/2))/sqrt(3). - Stefano Spezia, Aug 04 2025
Comments