A123737 Partial sums of (-1)^floor(n*sqrt(2)).
-1, 0, 1, 0, -1, 0, -1, -2, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1, 2, 1, 0, 1, 0, -1, 0, 1, 0, -1, 0, -1, -2, -1, 0, -1, 0, 1, 0, -1, 0, -1, -2, -1, 0, -1, -2, -1, -2, -3, -2, -1, -2, -1, 0, -1, -2, -1, 0, -1, 0, 1, 0, -1, 0, -1, -2, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0, 1, 2, 1, 0, 1, 0, -1, 0, 1, 0, -1, 0, -1, -2, -1, 0, -1, 0, 1, 0, -1, 0, 1, 0
Offset: 1
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
- Henk Bruin and Robbert Fokkink, On the records and zeros of a deterministic random walk, arXiv:2503.11734 [math.DS], 2025. See p. 2.
- Kevin O'Bryant, Bruce Reznick and Monika Serbinowska, Almost alternating sums, arXiv:math/0308087 [math.NT], 2003-2205; Amer. Math. Monthly, Vol. 113 (October 2006), pp. 673-688.
Crossrefs
Programs
-
Magma
[&+[(-1)^Floor(j*Sqrt(2)): j in [1..n]]: n in [1..130]]; // G. C. Greubel, Sep 05 2019
-
Maple
ListTools:-PartialSums([seq((-1)^floor(n*sqrt(2)),n=1..100)]); # Robert Israel, Jun 02 2015
-
Mathematica
Rest[FoldList[Plus,0,(-1)^Floor[Sqrt[2]*Range[120]]]] Accumulate[(-1)^Floor[Range[120]Sqrt[2]]] (* Harvey P. Dale, Jan 16 2012 *) (* The positions of the first occurrences of n and -n in this sequence: *) stab = Rest[FoldList[Plus,0,(-1)^Floor[Sqrt[2]*Range[1000000]]]]; Print[Table[FirstPosition[stab,n][[1]],{n,1,8}]]; Print[Table[FirstPosition[stab,-n][[1]],{n,1,8}]]; (* Vaclav Kotesovec, Jun 02 2015 *)
-
PARI
a(n)=sum(i=1,n,(-1)^sqrtint(2*i^2)) \\ Charles R Greathouse IV, Feb 07 2013
-
Sage
[sum((-1)^floor(j*sqrt(2)) for j in (1..n)) for n in (1..130)] # G. C. Greubel, Sep 05 2019
Formula
O'Bryant, Reznick, & Serbinowska show that |a(n)| <= k log n + 1, with k = 1/(2 log (1 + sqrt(2))), and further -a(n) > k log n + 0.78 infinitely often. - Charles R Greathouse IV, Feb 07 2013
Comments