A123738 Partial sums of (-1)^floor(n*Pi).
-1, 0, -1, 0, -1, 0, -1, -2, -1, -2, -1, -2, -1, -2, -3, -2, -3, -2, -3, -2, -3, -4, -3, -4, -3, -4, -3, -4, -5, -4, -5, -4, -5, -4, -5, -6, -5, -6, -5, -6, -5, -6, -7, -6, -7, -6, -7, -6, -7, -8, -7, -8, -7, -8, -7, -8, -9, -8, -9, -8, -9, -8, -9, -10, -9, -10, -9, -10, -9, -10, -11, -10, -11, -10, -11, -10, -11, -12, -11, -12
Offset: 1
Links
- T. D. Noe, Table of n, a(n) for n=1..10000
- Kevin O'Bryant, Bruce Reznick and Monika Serbinowska, Almost alternating sums, arXiv:math/0308087 [math.NT], 2003-2005.
- Kevin O'Bryant, Bruce Reznick and Monika Serbinowska, Almost alternating sums, Amer. Math. Monthly, Vol. 113 (October 2006), 673-688.
Programs
-
Magma
R:= RealField(20); [&+[(-1)^Floor(j*Pi(R)): j in [1..n]]: n in [1..130]]; // G. C. Greubel, Sep 05 2019
-
Mathematica
Rest[FoldList[Plus,0,(-1)^Floor[Pi*Range[120]]]]
-
PARI
vector(130, n, sum(j=1,n, (-1)^(j\(1/Pi))) ) \\ G. C. Greubel, Sep 05 2019
-
Sage
[sum((-1)^floor(j*pi) for j in (1..n)) for n in (1..130)] # G. C. Greubel, Sep 05 2019