# What is the average rational number?

Let $Q=\mathbb Q \cap(0,1)= \{r_1,r_2,\ldots\}$ be the rational numbers in $(0,1)$ listed out so we can count them. Define $x_n=\frac{1}{n}\sum_{k=1}^nr_n$ to be the average of the first $n$ rational numbers from the list.

Questions:

1. What is required for $x_n$ to converge? Certainly $0< x_n < 1$ for all $n$.

2. Does $x_n$ converge to a rational or irrational?

3. How does the behavior of the sequence depend on the choice of list? I.e. what if we rearrange the list $\mathbb Q \cap(0,1)=\{r_{p(1)},r_{p(2)},\ldots\}$ with some one-to-one permutation $p: \mathbb N \to \mathbb N$? How does the behavior of $x_n$ depend on $p$?

My thoughts:

Intuitively, I feel that we might be able to choose a $p$ so that $x_n\rightarrow y$ for any $y\in[0,1]$. However, it also makes intuitive sense that, if each rational appears only once in the list, that the limit is required to be $\frac{1}{2}.$ Of course, intuition can be very misleading with infinities!

If we are allowed to repeat rational numbers with arbitrary frequency (but still capturing every rational eventually), then we might be able to choose a listing so that $x_n\rightarrow y$ for any $y\in(0,\infty)$.

This last point might be proved by the fact that every positive real number has a sequence of positive rationals converging to it, and every rational in that list can be expressed as a sum of positive rationals less than one. However, the averaging may complicate that idea, and I'll have to think about it more.

Example I:

No repetition:

in which case $x_n\rightarrow\frac{1}{2},$ a very nice and simple example. Even if we keep the non-reduced fractions and allow repetition, i.e. with
$Q=\{\frac{1}{2},\frac{1}{3},\frac{2}{3},\frac{1}{4},\boxed{\frac{2}{4},}\frac{3}{4},\frac{1}{5},\ldots\},$
then $x_n\rightarrow\frac{1}{2}.$ The latter case is easy to prove since we have the subsequence $x_{n_k}=\frac{1}{2}$ for $n_k=\frac{k(k+1)}{2},$ and the deviations from $1/2$ decrease. The non-repetition case, I haven't proved, but simulated numerically, so there may be an error, but I figure there is an easy calculation to show whether it's correct.

Example II:

Consider the list generated from the Stern-Brocot tree:

I'm sure this list could be studied analytically, but for now, I've just done a numerical simulation. The sequence of averages $x_n$ hits $\frac{1}{2}$ infinitely often, but may be oscillatory and hence not converge. If it converges, it does so much slower than the previous examples. It appears that $x_{2^k-1}=0.5$ for all $k$ and that between those values it comes very close to $0.44,$ e.g. $x_{95743}\approx 0.4399.$ However, my computer code is probably not very efficient, and becomes very slow past this.

Depending on how you order the rationals to begin with, the sequence $x_n$ could tend to anything in $[0,1]$ or could diverge.

Say $y\in[0,1]$. Start with an enumeration $r_1,\dots$ of the rationals in $(0,1)$. When I say "choose a rational such that [whatever]" I mean you should choose the first rational currently on that list that satisfies [whatever], and then cross it off the list.

Start by choosing $10$ rationals in $I_1=(y-1/10,y+1/10)$. Then choose one rational in $[0,1]\setminus I_1$. Then choose $100$ rationals in $I_2=(y-1/100,y+1/100)$, and then choose one rational in $[0,1]\setminus I_2$. Etc.

First, note we have in fact defined a reordering of the original list. No rational appears in the new ordering more than once, because it is crossed off the original list the first time it is chosen. And every rational appears on the new list. In fact you can show by induction on $n$ that $r_n$ must be chosen at some stage: By induction you can assume that every $r_j$ for $j is chosen at some stage. So at some stage $r_n$ is the first remaining entry on the original list; hence it will be chosen soon, since either it's in $I_k$ or not.

And for large $n$ the vast majority of the rationals in the first $n$ elements of the new ordering are very close to $y$, hence $x_n\to y$.

(Similarly, to get $x_n$ to diverge: Start with a large number of rationals near $0$. Follow with a huge number of rationals near $1$, then a stupendous number of rationals near $0$...)