Not an answer. When asked in the comments to guess whether the partial sums are bounded or unbounded, I replied, "Unbounded for all irrational $\alpha > 1,$ but that is only a guess (not even an educated one - I'm pretty new to this topic)."
My own notes on the problem are reproduced at the end of this comment/answer. (Disturbing events in Maths.SE have made it impossible for me to take my work any further, in the two days since the row erupted. Another guess: I don't think there was ever much chance of my work leading to a solution. However, I think my notation, and the few inequalities I've proved, may be useful to others as well as myself, although my proofs are almost certainly stupidly complicated. I intend to update this answer, with improved proofs if at all possible, if I'm allowed to concentrate again.)
This comment/answer, for what it's worth, consists of some data, and now also the Python code that produced it, followed by a hastily-assembled explanation of the algorithm, based upon my private notes (which, as I say, may have some value independent of the algorithm):
$$
\begin{array}{|r|r|}
\hline
B_n(\pi) & n \\
\hline
{-1} & 25 \\
{-2} & 358 \\
{-3} & 104{,}351 \\
{4} & 312{,}692 \\
{5} & 625{,}381 \\
{6} & 938{,}070 \\
{-4} & 2{,}084{,}478 \\
{-5} & 6{,}357{,}421 \\
{-6} & 86{,}501{,}278 \\
{-7} & 166{,}645{,}135 \\
{7} & 412{,}496{,}057 \\
{8} & 824{,}054{,}044 \\
{9} & 1{,}235{,}612{,}031 \\
{10} & 1{,}647{,}170{,}018 \\
{11} & 2{,}058{,}728{,}005 \\
{12} & 2{,}470{,}285{,}992 \\
{-8} & 7{,}986{,}246{,}888 \\
{-9} & 8{,}066{,}390{,}745 \\
{-10} & 18{,}515{,}628{,}134 \\
{-11} & 36{,}864{,}611{,}133 \\
\hline
\end{array}
\quad
\begin{array}{|r|r|}
\hline
B_n(\sqrt{10}) & n \\
\hline
{4} & 22 \\
{5} & 41 \\
{6} & 60 \\
{7} & 79 \\
{8} & 98 \\
{9} & 117 \\
{10} & 838 \\
{11} & 1{,}559 \\
{12} & 2{,}280 \\
{13} & 3{,}001 \\
{14} & 3{,}722 \\
{15} & 4{,}443 \\
{16} & 31{,}822 \\
{17} & 59{,}201 \\
{18} & 86{,}580 \\
{19} & 113{,}959 \\
{20} & 141{,}338 \\
{21} & 168{,}717 \\
{22} & 1{,}208{,}398 \\
{23} & 2{,}248{,}079 \\
\hline
\end{array}
\
\begin{array}{c}
\begin{array}{|r|r|}
\hline
B_n(\sqrt{10}) & n \\
\hline
{24} & 3{,}287{,}760 \\
{25} & 4{,}327{,}441 \\
{26} & 5{,}367{,}122 \\
{27} & 6{,}406{,}803 \\
{28} & 45{,}887{,}302 \\
{29} & 85{,}367{,}801 \\
{30} & 124{,}848{,}300 \\
{31} & 164{,}328{,}799 \\
{32} & 203{,}809{,}298 \\
{33} & 243{,}289{,}797 \\
{34} & 1{,}255{,}929{,}484 \\
{35} & 2{,}268{,}569{,}171 \\
{36} & 9{,}357{,}046{,}980 \\
{37} & 10{,}856{,}266{,}261 \\
{38} & 12{,}355{,}485{,}542 \\
\hline
\end{array}
\\
\mathstrut \\
\mathstrut \\
\mathstrut \\
\mathstrut \\
\mathstrut \\
\end{array}
$$
I'm sorry about the poor formatting. I'll try to improve it in future updates. As I wrote in another comment: "The latest update has been delayed, because the formatting of my new tables uses a lot of \framebox commands, and I've only just found out (the hard way) that these aren't supported
by MathJax."
The computations used $100$ decimal digits of precision. I didn't check rigorously for possible errors in the $2{,}000{,}000{,}000$ iterations for $B_n(\pi),$ or $680{,}000{,}000$ iterations for $B_n(\sqrt{10}),$ each iteration requiring the rounding of one real number to an integer. I intend to add such checks later.
No comment $\ldots\ \ddot\frown$
I had planned to do a lot more work on this answer today, along several independent tracks at once, but $[\ldots]$!
I will simply post the unpolished Python 3 code that I used to generate the table, with instructions on running it. (Don't worry, it's easy.) What it probably most needs is the inclusion of tests for inaccurate rounding to an integer value. (It should throw an exception if this occurs.) Also quite unsatisfactory is that it deals only with the computation of $B_n(\alpha)$ for irrational $\alpha$ such that $m < \alpha < m + \tfrac12$ for some positive integer $m.$ The formulae for the case $m + \tfrac12 < \alpha < 1$ are almost identical. I planned to code them in Python as well before updating my answer. (Oh, well.)
It would only be slightly more complicated to write code that handles all irrational $\alpha > 1$ in a uniform way, but I don't think there is any point in doing that, as I shall try to explain. $[\ldots]$
While explaining the code, I'll present the formulae I've been using, with proofs. I'm having to grit my teeth to do that, because my proofs were arrived at in a crazily roundabout way, and probably still bear traces of their origin, even though there is almost bound to be an "obvious" simplification. That was another of the many aspects of the problem that I planned to work on today. (Oh, well.)
On some future, happier day, perhaps we can put our heads together, and as well as simplifying my stupid proofs (if I haven't managed to do that myself), we might decide on a common notation to use when communicating about the problem. But first I have to present my own notation. That's a big enough task for one time, without complicating it with premature attempts at collaboration. (That's one of several good reasons why this isn't a Community Wiki post.) $[\ldots]$
Anyway, I have to break for dinner now. Here follows the unpolished code for my Python module, which I have been running under version 3.8.1 (64-bit), not that that should matter much. $[\ldots]$
The code can probably be speeded up quite considerably by installing gmpy2, but this depends on previously installing Microsoft Visual C++ 14.0. (You've guessed it, that was another of the many, many things I was planning to do today $[\ldots]$) Yes, I should have mentioned that I use a Windows machine. For running under Linux or other Unix-like OS (perhaps anything but Windows), you'll need to add some sort of "shebang" thing at the beginning (but you'll know what do, and I don't).
Update 1
# \Work\Comp\Python\3\Lib\maths\spinoff.py
#
# Thu 25 Jun 2020 (created)
# Mon 29 Jun 2020 (updated)
# Thu 2 Ju1 2020 (trivial update)
"""Almost alternating: https://math.stackexchange.com/q/3731454.
Now see also this: https://math.stackexchange.com/q/3737600."""
all = ['state']
from math import floor, ceil
from mpmath import mp
class state(object):
# Mon 29 Jun 2020 (created)
# Thu 2 Ju1 2020 (trivial update)
"""
Place in list of possibly extreme sums of (-1)^k: k in Beatty sequence.
"""
def __init__(self, j=0, B_n=0, maxB=0, minB=0, alpha=mp.pi):
# Mon 29 Jun 2020 (created)
# Mon 29 Jun 2020 (updated)
"""
Initialise state from parameters (copied and pasted from previous run).
"""
self.m = floor(alpha)
if alpha == self.m or alpha < 1:
raise ValueError
self.beta = 1/(alpha - self.m) - 1
if self.beta == floor(self.beta) or self.beta < 1:
raise ValueError
self.alpha = alpha
self.B_n = B_n
self.maxB = maxB
self.minB = minB
self.j = j
self.sj = ceil(self.j*self.beta)
self.n = self.sj*self.m + self.j*(self.m + 1)
self.k = floor(self.n/alpha)
self.sgn = 1 - 2*(self.k % 2) # = (-1)**k
self.record = [] # list of new record-breaking tuples (B_n, n, k, j)
def readout(self):
# Mon 29 Jun 2020 (created)
# Mon 29 Jun 2020 (updated)
"""
Read out the present state of the computation.
"""
return (self.j, self.B_n, self.maxB, self.minB, self.alpha)
def advance(self, loops=40000000):
# Mon 29 Jun 2020 (created)
# Thu 2 Ju1 2020 (trivial update)
"""
Increment the value of j the given number of times.
"""
old_j = self.j
for self.j in range(old_j + 1, old_j + loops + 1):
old_sj = self.sj # = ceil((j-1)*beta)
self.sj = ceil(self.j*self.beta)
p = self.sj - old_sj
self.n += p*self.m
self.k += p
if p % 2: # p is odd
self.B_n += self.sgn*self.m
self.sgn = -self.sgn
self.n += self.m + 1
self.k += 1
self.B_n += self.sgn*(self.m + 1)
self.sgn = -self.sgn
if self.B_n > self.maxB:
self.record.append((self.B_n, self.n, self.k, self.j))
self.maxB = self.B_n
if self.B_n < self.minB:
self.record.append((self.B_n, self.n, self.k, self.j))
self.minB = self.B_n
def main():
mp.dps = 100
dat = state()
dat.advance(1000000)
print(dat.readout())
print(dat.record)
if name == 'main':
main()
end spinoff.py
The beginning of the log of the interactive session (using IDLE) that
produced the table for $B_n(\sqrt{10})$ should give enough of an idea
of how to run the program (please post any difficulties or bug reports
as comments on this answer):
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> from maths import spinoff
>>> from mpmath import mp
>>> mp.dps = 100
>>> a = mp.sqrt(10)
>>> a
mpf('3.162277660168379331998893544432718533719555139325216826857504852792594438639238221344248108379300295183')
>>> a**2
mpf('10.0')
>>> dat = spinoff.state(0, 0, 0, 0, a)
>>> dat.readout()
(0, 0, 0, 0, mpf('3.162277660168379331998893544432718533719555139325216826857504852792594438639238221344248108379300295183'))
>>> dat.record
[]
>>> dat.advance(10000000)
>>> dat.readout()
(10000000, 19, 31, 0, mpf('3.162277660168379331998893544432718533719555139325216826857504852792594438639238221344248108379300295183'))
>>> dat.record
[(4, 22, 7, 1), (5, 41, 13, 2), (6, 60, 19, 3), (7, 79, 25, 4), (8, 98, 31, 5), (9, 117, 37, 6), (10, 838, 265, 43), (11, 1559, 493, 80), (12, 2280, 721, 117), (13, 3001, 949, 154), (14, 3722, 1177, 191), (15, 4443, 1405, 228), (16, 31822, 10063, 1633), (17, 59201, 18721, 3038), (18, 86580, 27379, 4443), (19, 113959, 36037, 5848), (20, 141338, 44695, 7253), (21, 168717, 53353, 8658), (22, 1208398, 382129, 62011), (23, 2248079, 710905, 115364), (24, 3287760, 1039681, 168717), (25, 4327441, 1368457, 222070), (26, 5367122, 1697233, 275423), (27, 6406803, 2026009, 328776), (28, 45887302, 14510839, 2354785), (29, 85367801, 26995669, 4380794), (30, 124848300, 39480499, 6406803), (31, 164328799, 51965329, 8432812)]
>>> from math import floor
>>> def sgn(n):
return 1 - 2*(n % 2) # = (-1)**n
>>> def B(n):
return sum([sgn(floor(i/a)) for i in range(1, n+1)])
>>> [B(n) for n in range(100)]
[0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 8, 7]
>>> [B(n) for n in [22, 41, 60, 79, 98, 117, 838, 1559, 2280, 3001, 3722, 4443, 31822]]
[4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
>>> # So far, so good.
>>> B(113959)
19
>>> B(1208398)
22
>>> B(6406803)
27
>>> B(45887302)
28
>>> # Still OK. I think that's enough checking.
From another comment:
N.B. There is a bug in my Python code that
can cause daft results if you initialise an object with non-default
parameters in order to resume a computation from a previously reached
state. It's probably easy to fix, but I haven't given it any thought yet.
I've been extending the table for $B_n(\pi),$ and building a table for
$B_n(\sqrt{10}).$ It'd be nice to code the $q_j$ version of the formulae,
so that I can do $B_n(e),$ and perhaps $B_n(\sqrt8),$ but I'd better fix
the $p_j$ version first. A nice surprise was that computing with $100$
digits of precision seems almost as fast as with $50.$
Update 2
This is a lightly edited dump of some $\LaTeX{}$ed notes I have been writing, for my own private use, since Thursday 25 June. (There are also handwritten notes, starting from Tuesday 23, some of which have not yet been $\LaTeX{}$ed. They fill in one or two gaps left here, but not very much.)
It is necessary to give this context, because these notes were not written for "publication", and my arguments follow a meandering course, leading to simple conclusions which must almost surely be "obvious", if only with hindsight. Also, there is nothing startling here; it is very plodding stuff! But without it, the code of my Python module will read like, well, code; and for reasons I won't go into now - they are in the edit history, and in dozens of comments, mostly now deleted, and in a Meta thread (which I'm not following at the moment, so that I can concentrate on this job) - I have been virtually forced to dump all of my unpolished Python code here, and I am now faced with having to explain it as best I can. I hope that the notation I use, at least, will also be of some use to others.
$\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}$
Given an irrational number $\alpha > 1,$ we are interested in the
Beatty sequence of non-negative integers
$(\floor{n/\alpha})_{n\geqslant1}.$ For each
non-negative integer $k,$ let $r_k$ be the number of times $k$
occurs in the Beatty sequence for $1/\alpha.$ Then $r_k$ is always
$m$ or $m + 1,$ and in particular $r_0 = m,$ where
$m = \floor{\alpha},$ i.e. $m$ is the unique positive integer such that
$$
m < \alpha < m + 1.
$$
For each positive integer $j,$ let $p_j$ be the length of the
$j^\text{th}$ group of consecutive values of $k$ for which
$r_k = m,$ and let $q_j$ be the length of the $j^\text{th}$
group of consecutive values of $k$ for which $r_k = m + 1.$
For every positive integer $j,$
\begin{gather}
\notag
[(p_1 + \cdots + p_j)m + (q_1 + \cdots + q_{j-1})(m + 1) + 1]
/\alpha > p_1 + q_1 + \cdots + q_{j-1} + p_j, \\
\notag\text{and }\
[(p_1 + \cdots + p_j)m + (q_1 + \cdots + q_{j-1} + 1)(m + 1)]
/\alpha \\ < p_1 + q_1 + \cdots + q_{j-1} + p_j + 1, \\
\notag\text{so }\
m + \frac{q_1 + \cdots + q_{j-1} + 1}
{p_1 + q_1 + \cdots + q_{j-1} + p_j + 1}
< \alpha <
m + \frac{q_1 + \cdots + q_{j-1} + 1}
{p_1 + q_1 + \cdots + q_{j-1} + p_j}, \\
\notag\text{i.e. }\
1 + \frac{p_1 + \cdots + p_j - 1}{q_1 + \cdots + q_{j-1} + 1} <
\frac1{\alpha - m} <
1 + \frac{p_1 + \cdots + p_j}{q_1 + \cdots + q_{j-1} + 1}, \\
\notag\text{i.e. }\
p_j <
(q_1 + \cdots + q_{j-1} + 1)\left(\frac1{\alpha - m} - 1\right)
- p_1 - \cdots - p_{j-1} + 1
< p_j + 1, \\
\label{3731454:eq:P}\tag{P}
\text{i.e. }\
p_j = \ceil{(q_1 + \cdots + q_{j-1} + 1)\left(\frac1
{\alpha - m} - 1\right)} - p_1 - \cdots - p_{j-1}.
\end{gather}
Similarly,
\begin{gather}
\notag
[(p_1 + \cdots + p_j)m + (q_1 + \cdots + q_j)(m + 1)]/\alpha <
p_1 + q_1 + \cdots + p_j + q_j, \\
\notag\text{and }\
[(p_1 + \cdots + p_j)m + (q_1 + \cdots + q_j + 1)(m + 1)]/\alpha \\
\notag
> p_1 + q_1 + \cdots + p_j + q_j + 1, \\
\notag\text{therefore }\
m + \frac{q_1 + \cdots + q_j}
{p_1 + q_1 + \cdots + p_j + q_j} < \alpha <
m + \frac{q_1 + \cdots + q_j + 1}
{p_1 + q_1 + \cdots + p_j + q_j + 1}, \\
\notag\text{i.e. }\
1 + \frac{p_1 + \cdots + p_j}{q_1 + \cdots + q_j + 1} <
\frac1{\alpha - m} <
1 + \frac{p_1 + \cdots + p_j}{q_1 + \cdots + q_j}, \\
\notag\text{i.e. }\
q_j < (p_1 + \cdots + p_j)\left(
\frac1{\alpha - m} - 1\right)^{-1}\!\!
- q_1 - \cdots - q_{j-1} < q_j + 1, \\
\label{3731454:eq:Q}\tag{Q}
\text{i.e. }\
q_j = \floor{(p_1 + \cdots + p_j)\left(
\frac1{\alpha - m} - 1\right)^{-1}} - q_1 - \cdots - q_{j-1}.
\end{gather}
If $m<\alpha< m+\tfrac12,$ then $2m+2$ successive multiples of $1/\alpha$ occupy
a closed interval of length $(2m+1)/\alpha>2,$ therefore $q_j=1$ for all $j.$
Similarly, if $m + \tfrac12 < \alpha < m + 1,$ then $2m + 2$ successive multiples
of $1/\alpha$ occupy a closed interval of length $(2m + 1)/\alpha < 2,$ therefore
$p_j=1$ for all $j.$
(That is why there seems little point in writing Python code to deal with both cases in a uniform manner, especially in view of what comes next.)
Define
$$
\beta = \frac1{\alpha - m} - 1,
$$
so that
\begin{align*}
\beta > 1 & \text{ if } m < \alpha < m + \frac12, \\
\beta < 1 & \text{ if } m + \frac12 < \alpha < m + 1.
\end{align*}
Then
\begin{align*}
\text{if } m < \alpha < m + \frac12 \text{ then }
p_j & = \ceil{j\beta} - p_1 - \cdots - p_{j-1}, \\
\text{if } m + \frac12 < \alpha < m + 1 \text{ then }
q_j & = \floor{\frac{j}{\beta}} - q_1 - \cdots - q_{j-1},
\end{align*}
and it is now obvious, by induction on $j$ (I'm sure it really ought to be obvious
without any of this palaver, but I haven't had a chance to think any more about it
today), that
\begin{align*}
\text{if } m < \alpha < m + \frac12 \text{ then }
p_j & = \ceil{j\beta} - \ceil{(j - 1)\beta}, \\
\text{if } m + \frac12 < \alpha < m + 1 \text{ then }
q_j & = \floor{\frac{j}{\beta}} - \floor{\frac{j - 1}{\beta}},
\end{align*}
(By an astonishing synchronicity, this
question came up on Saturday 27 June, just before I started writing things in this
way, but I was so thick-headed that the penny didn't drop for about a day!)
The equation for $p_j$ has been pretty thoroughly checked, but I haven't done much
with the equation for $q_j,$ so regard it with (even more) suspicion (unless, that
is, both these equations are even more howlingly obvious than I imagine they must be).
Note the implications that
\begin{align*}
\text{if } m < \alpha < m + \frac12 \text{ then }
p_j & = \ceil{\beta} \text{ or } \floor{\beta} \text{ for all } j, \\
\text{if } m + \frac12 < \alpha < m + 1 \text{ then }
q_j & = \floor{\frac1{\beta}} \text{ or } \ceil{\frac1{\beta}} \text{ for all } j.
\end{align*}
Assume from now on that $m < \alpha < m + \frac12.$ (This is, of course, merely
because I wanted to get on with writing Python code for computing $B_n(\pi).$
There is no suggestion that the other case is not of equal interest.)
In a provisional notation, let
$$
s(j) = p_1 + \cdots + p_j = \ceil{j\beta} \quad (j \geqslant 1).
$$
In a possibly unwise notation (but I should have some notation for it), let
$$
l(n) = \floor{\frac{n}\alpha} \quad (n \geqslant 1)
$$
(I changed that immediately!), and of course
$$
B_n = B_n(\alpha) = \sum_{i=1}^n(-1)^{l(i)} \quad (n \geqslant 1).
$$
It seems almost "obvious" now (and I imagine it should be easy enough to prove)
that the crucial values of $n,$ the only ones for which $B_n$ can take on new
maximum or minimum values, are
$$
t(j) = s(j)m + j(m + 1) \quad (j \geqslant 1).
$$
We should have
$$
l(t(j) - m) = l(t(j) - m + 1) = \cdots = l(t(j) - 1) = l(t(j))
\quad (j \geqslant 1).
$$
(I think I did prove all of this, but only in my handwritten notes. The horrible
controversy in Maths.SE erupted, I think, on the morning after the night when I
had arrived at this point, and begun doing systematic computations, so I've had no
time to work through all of this properly. But I will be updating this answer.)