A057078 Periodic sequence 1,0,-1,...; expansion of (1+x)/(1+x+x^2).
1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1, 1, 0, -1
Offset: 0
Examples
G.f. = 1 - x^2 + x^3 - x^5 + x^6 - x^8 + x^9 - x^11 + x^12 - x^14 + x^15 + ...
Links
- Winston de Greef, Table of n, a(n) for n = 0..10000
- Ralph E. Griswold, Shaft Sequences
- Index entries for sequences related to Chebyshev polynomials.
- Index entries for linear recurrences with constant coefficients, signature (-1,-1).
Crossrefs
Programs
-
Haskell
a057078 = (1 -) . (`mod` 3) -- Reinhard Zumkeller, Mar 22 2013
-
Maple
A057078:=n->1-(n mod 3); seq(A057078(n), n=0..100); # Wesley Ivan Hurt, Dec 06 2013
-
Mathematica
a[n_] := {1, 0, -1}[[Mod[n, 3] + 1]] (* Jean-François Alcover, Jul 05 2013 *) CoefficientList[Series[(1 + x) / (1 + x + x^2), {x, 0, 40}], x] (* Vincenzo Librandi, Nov 03 2014 *) LinearRecurrence[{-1, -1},{1, 0},90] (* Ray Chandler, Sep 15 2015 *)
-
PARI
{a(n) = [1, 0, -1][n%3 + 1]}; /* Michael Somos, Oct 15 2008 */
-
Sage
def A057078(): x, y = -1, 0 while True: yield -x x, y = y, -x -y a = A057078(); [next(a) for i in range(40)] # Peter Luschny, Jul 11 2013
Formula
a(n) = S(n, -1) + S(n - 1, -1) = S(2*n, 1); S(n, x) := U(n, x/2), Chebyshev polynomials of 2nd kind, A049310. S(n, -1) = A049347(n). S(n, 1) = A010892(n).
From Mario Catalani (mario.catalani(AT)unito.it), Jan 08 2003: (Start)
a(n) = (1/2)*((-1)^floor(2*n/3) + (-1)^floor((2*n+1)/3)).
a(n) = -a(n-1) - a(n-2).
a(n) = Sum_{k=0..n} binomial(n+k, 2k)*(-1)^(n-k) = Sum_{k=0..floor((n+1)/2)} binomial(n+1-k, k)*(-1)^(n-k). - Mario Catalani (mario.catalani(AT)unito.it), Aug 20 2003
Binomial transform is A010892. a(n) = 2*sqrt(3)*sin(2*Pi*n/3 + Pi/3)/3. - Paul Barry, Sep 13 2003
a(n) = cos(2*Pi*n/3) + sin(2*Pi*n/3)/sqrt(3). - Paul Barry, Oct 27 2004
a(n) = Sum_{k=0..n} (-1)^A010060(2n-2k)*(binomial(2n-k, k) mod 2). - Paul Barry, Dec 11 2004
a(n) = (4/3)*(|sin(Pi*(n-2)/3)| - |sin(Pi*n/3)|)*|sin(Pi*(n-1)/3)|. - Hieronymus Fischer, Jun 27 2007
a(n) = 1 - (n mod 3) = 1 + 3*floor(n/3) - n. - Hieronymus Fischer, Jun 27 2007
Euler transform of length 3 sequence [0, -1, 1]. - Michael Somos, Oct 15 2008
a(n) = a(n-1)^2 - a(n-2)^2 with a(0) = 1, a(1) = 0. - Francesco Daddi, Aug 02 2011
E.g.f.: exp(-x/2)*(3*cos(sqrt(3)*x/2) + sqrt(3)*sin(sqrt(3)*x/2))/3. - Stefano Spezia, May 16 2023
a(n) = -a(-1-n) for all n in Z. - Michael Somos, Feb 20 2024
From Peter Bala, Sep 08 2024: (Start)
G.f. A(x) satisfies A(x) = (1 + x)*(1 - x*A(x)).
1/x * series_reversion(x/A(x)) = the g.f of A364374. (End)
Comments