TITLE: Sequences with integral means
QUESTION [22 upvotes]: Let $S(n)$ be the sequence whose first element is $n$, and from then onward,
the next element is the smallest natural number ${\ge}1$ that ensures that the
mean of all the numbers in the sequence is an integer.
For example, the second element of $S(4)$ cannot be $1$ (mean $\frac{5}{2}$),
but $2$ works: $S(4)=4,2,\ldots$. Then the third element cannot be 
$1$ (mean $\frac{7}{3}$)
or $2$ (mean $\frac{8}{3}$), but $3$ works: $S(4)=4,2,3,\ldots$.
And from then on, the elements are all $3$'s, which I'll write as 
$S(4)=4,2,\overline{3}$.
Here are a few more examples:
$$S(1)=1,\overline{1}$$
$$S(2)=2,2,\overline{2}$$
$$S(3)=3,1,\overline{2}$$
$$S(4)=4,2,\overline{3}$$
$$S(5)=5,1,\overline{3}$$
$$S(11)=11,1,3,1,\overline{4}$$
$$S(32)=32,2,2,4,5,3,1,\overline{7}$$
$$S(111)=111,1,2,2,4,6,7,3,8,6,4,2,\overline{13}$$
$$S(112)=112,2,3,3,5,1,7,3,8,6,4,2,\overline{13}$$
$$S(200)=200,2,2,4,2,6,1,7,1,5,1,9,7,5,3,1,\overline{16}$$
Has anyone studied these sequences?
Is there a simple proof that each sequence ends with a repeated number
$\overline{m}$?
Is there a way to predict the value of $m$ from the start $n$ without computing the
entire sequence up to $\overline{m}$?
Might it be that the repeat value $m=r(n)$ satisfies $r(n+1) \ge r(n)$?
This question occurred to me when thinking about streaming computation of means,
a not-infrequent calculation (e.g., computing mean temperatures).

Added, supporting the discoveries of several commenters: $r(n)$ red,
and now fit with $1.135 \sqrt{n}$ blue for $n\le 10000$:
 

As per Eckhard's request, with Will's function $\sqrt{4n/3} -1/2$:

REPLY [16 votes]: Will Sawin's guess that the mean stabilizes around $2\sqrt{n/3}$ is very close to the correct answer, but not quite!  Asymptotically the right answer is $\sim 2\sqrt{n/\pi}$. Note that $2/\sqrt{\pi}$ is about $1.12837\ldots$.  
To see why this is, suppose that $n$ is large, and let $\ell$ also be large, but 
small compared with $n$.   Consider the number of steps $k$ needed until the mean first dips below $k\ell$.  It is easy to see that $k\sim \sqrt{n/\ell}$.  Now if we continue from step $k$, the mean must first drop by $\ell-1$ at each step, until we get to a point $k_1$ such that the mean at this point $k_1$ dips below $k_1(\ell-1)$.  It is easy to see that $k_1$ is about $k(2\ell-1)/(2\ell-2)$.  From here on at each step the mean drops by $\ell -2$ at each step, until we arrive at a point $k_2$ where the mean has dipped below $k_2(\ell-2)$.  Now $k_2$ is about 
$$ 
k\Big(\frac{2\ell-1}{2\ell-2}\Big) \Big(\frac{2\ell-3}{2\ell-4}\Big). 
$$ 
And so on.  (In following the above calculations, the comment of Sergei Ivanov is useful.)
In this manner we find that the number of steps taken to terminate  (which is also the size of the final mean) is about 
$$ 
\sqrt{n/\ell} \Big(\frac{2\ell-1}{2\ell-2}\Big) \cdots \Big(\frac{5}{4}\Big)\Big(\frac{3}{2}\Big).
$$
Computing this using Stirling's formula finishes the proof.
Note:  Everyone writes, no one reads! (Myself included, of course.)  I just looked at the OEIS reference linked by Elkies, and the $\sim 2\sqrt{n/\pi}$ result essentially appears there.  Apparently this is first due to Viggo Brun himself, and refined by M.E. Andersson in a paper in Acta Arithmetica (see http://matwbn.icm.edu.pl/ksiazki/aa/aa85/aa8542.pdf ).  But the paper is in German and six pages long, so the above short proof may still be useful.