%I #61 Dec 31 2023 10:14:43
%S 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,
%T 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,
%U -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
%N a(n) = (-1)^binomial(n+1,2).
%C Period 4: repeat [1, -1, -1, 1]. - _Joerg Arndt_, Feb 14 2016
%C Also equal to the sign of product(j-i, 1<=j<i<=n+1) = the sign of the Vandermonde determinant for -1, -2, ..., -(n+1).
%C Hankel transform of A097331, A097332. [_Paul Barry_, Aug 10 2009]
%C The Kn22 sums, see A180662, of triangle A108299 equal the terms of this sequence. [_Johannes W. Meijer_, Aug 14 2011]
%D I. S. Gradstein and I. M. Ryshik, Tables of series, products, and integrals, Volume 1, Verlag Harri Deutsch, 1981.
%H Gary Detlefs and Wolfdieter Lang, <a href="https://arxiv.org/abs/2304.12937">Improved Formula for the Multi-Section of the Linear Three-Term Recurrence Sequence</a>, arXiv:2304.12937 [math.CO], 2023.
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,-1).
%F a(n) = (-1)^A000217(n).
%F a(n) = (-1)^floor((n+1)/2). - _Benoit Cloitre_ and _Ray Chandler_, Sep 19 2003
%F G.f.: (1-x)/(1+x^2). - _Paul Barry_, Aug 10 2009
%F a(n) = I^(n*(n+1)). - _Bruno Berselli_, Oct 17 2011
%F 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
%F a(n) + a(n-2) = 0 for n>1, a(n) = a(n-4) for n>3. - _Wesley Ivan Hurt_, Jul 07 2016
%F E.g.f.: cos(x) - sin(x). - _Ilya Gutkovskiy_, Jul 07 2016
%F 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
%e a(1) = -1 since (-1)^binomial(2,2) = (-1)^1 = -1.
%e G.f. = 1 - x - x^2 + x^3 + x^4 - x^5 - x^6 + x^7 + x^8 - x^9 - x^10 + ...
%p A087960:=n->(-1)^binomial(n+1,2): seq(A087960(n), n=0..100); # _Wesley Ivan Hurt_, Jul 07 2016
%t (-1)^Binomial[Range[0,110],2] (* or *) LinearRecurrence[{0,-1},{1,1},110] (* _Harvey P. Dale_, Jul 07 2014 *)
%t a[ n_] := (-1)^(n (n + 1) / 2); (* _Michael Somos_, Jul 20 2015 *)
%t a[ n_] := (-1)^Quotient[ n + 1, 2]; (* _Michael Somos_, Jul 20 2015 *)
%o (PARI) {a(n) = (-1)^((n + 1)\2)}; /* _Michael Somos_, Jul 20 2015 */
%o (Haskell)
%o a087960 n = (-1) ^ (n * (n + 1) `div` 2)
%o a087960_list = cycle [1,-1,-1,1] -- _Reinhard Zumkeller_, Nov 15 2015
%o (Magma) [(-1)^Binomial(n+1,2) : n in [0..100]]; // _Wesley Ivan Hurt_, Jul 07 2016
%o (Python)
%o def A087960(n): return -1 if n+1&2 else 1 # _Chai Wah Wu_, Jan 31 2023
%Y Cf. A000217, A021913, A057077, A097331, A097332, A108299, A111125, A180662.
%K sign,easy
%O 0,1
%A _W. Edwin Clark_, Sep 17 2003
%E More terms from _Benoit Cloitre_ and _Ray Chandler_, Sep 19 2003
%E Offset and Vandermonde formula corrected by _R. J. Mathar_, Sep 25 2009
|