cp's OEIS Frontend

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.

A087960 a(n) = (-1)^binomial(n+1,2).

Original entry on oeis.org

1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1
Offset: 0

Views

Author

W. Edwin Clark, Sep 17 2003

Keywords

Comments

Period 4: repeat [1, -1, -1, 1]. - Joerg Arndt, Feb 14 2016
Also equal to the sign of product(j-i, 1<=j
Hankel transform of A097331, A097332. [Paul Barry, Aug 10 2009]
The Kn22 sums, see A180662, of triangle A108299 equal the terms of this sequence. [Johannes W. Meijer, Aug 14 2011]

Examples

			a(1) = -1 since (-1)^binomial(2,2) = (-1)^1 = -1.
G.f. = 1 - x - x^2 + x^3 + x^4 - x^5 - x^6 + x^7 + x^8 - x^9 - x^10 + ...
		

References

  • I. S. Gradstein and I. M. Ryshik, Tables of series, products, and integrals, Volume 1, Verlag Harri Deutsch, 1981.

Programs

  • Haskell
    a087960 n = (-1) ^ (n * (n + 1) `div` 2)
    a087960_list = cycle [1,-1,-1,1]  -- Reinhard Zumkeller, Nov 15 2015
    
  • Magma
    [(-1)^Binomial(n+1,2) : n in [0..100]]; // Wesley Ivan Hurt, Jul 07 2016
    
  • Maple
    A087960:=n->(-1)^binomial(n+1,2): seq(A087960(n), n=0..100); # Wesley Ivan Hurt, Jul 07 2016
  • Mathematica
    (-1)^Binomial[Range[0,110],2] (* or *) LinearRecurrence[{0,-1},{1,1},110] (* Harvey P. Dale, Jul 07 2014 *)
    a[ n_] := (-1)^(n (n + 1) / 2); (* Michael Somos, Jul 20 2015 *)
    a[ n_] := (-1)^Quotient[ n + 1, 2]; (* Michael Somos, Jul 20 2015 *)
  • PARI
    {a(n) = (-1)^((n + 1)\2)}; /* Michael Somos, Jul 20 2015 */
    
  • Python
    def A087960(n): return -1 if n+1&2 else 1 # Chai Wah Wu, Jan 31 2023

Formula

a(n) = (-1)^A000217(n).
a(n) = (-1)^floor((n+1)/2). - Benoit Cloitre and Ray Chandler, Sep 19 2003
G.f.: (1-x)/(1+x^2). - Paul Barry, Aug 10 2009
a(n) = I^(n*(n+1)). - Bruno Berselli, Oct 17 2011
a(n) = Product_{k=1..n} 2*cos(2*k*Pi/(2*n+1)) for n>=0 (for n=0 the empty product is put to 1). See the Gradstein-Ryshik reference, p. 63, 1.396 2. with x = sqrt(-1). - Wolfdieter Lang, Oct 22 2013
a(n) + a(n-2) = 0 for n>1, a(n) = a(n-4) for n>3. - Wesley Ivan Hurt, Jul 07 2016
E.g.f.: cos(x) - sin(x). - Ilya Gutkovskiy, Jul 07 2016
a(n) = Sum_{s=0..n} (-1)^(n-s)*A111125(n, s)*2^s (row polynomials of signed A111125 evaluated at 2). - Wolfdieter Lang, May 02 2021

Extensions

More terms from Benoit Cloitre and Ray Chandler, Sep 19 2003
Offset and Vandermonde formula corrected by R. J. Mathar, Sep 25 2009