An Interesting Question I Posed to Myself About $\pi$ as an Average.

You could define the sequence recursively in terms of the average of the previous terms of the sequence:

$$x_k = \begin{cases} 3 & \text{ if } & a_{k-1} > \pi \\ 4 & \text{ if } & a_{k-1} < \pi \\ \end{cases}$$

where

$$a_n = \frac {1}{n}\sum_k^n x_k$$


The convergence of $|a_n - \pi| \to 0$ follows from

$$- \frac{\pi - 3}{n} < a_n - \pi < \frac{4 - \pi}n$$

when $(x_{n-1}, x_n)$ is $(3, 4)$ or $(4, 3)$. Also, $|a_n - \pi|$ is decreasing in the other cases.

In the $(3, 4)$ case, $a_{n-1} < \pi$ so $$\begin{array} {rcl} a_n &=& (a_{n-1}\cdot(n-1) + 4)/n \\ &<& (\pi \cdot (n-1) + 4)/n \\ &=& \pi + (4 - \pi)/n \end{array}$$

Similarly for the $(4, 3)$ case.


To be pedantically rigorous, it would also need to pointed out that there is no final time $a_n - \pi$ changes signs.


Each term in either of these sums is equal to either $\left\lfloor\pi\right\rfloor = 3$ or $\left\lceil\pi\right\rceil = 4$: \begin{align*} \pi & = \lim_{n\to\infty}\frac{\left\lfloor{n\pi}\right\rfloor}{n} = \lim_{n\to\infty}\frac1{n}\sum_{i=1}^n(\left\lfloor{i\pi}\right\rfloor - \left\lfloor{(i - 1)\pi}\right\rfloor) \\ & = \lim_{n\to\infty}\frac{\left\lceil{n\pi}\right\rceil}{n} = \lim_{n\to\infty}\frac1{n}\sum_{i=1}^n(\left\lceil{i\pi}\right\rceil - \left\lceil{(i - 1)\pi}\right\rceil). \end{align*}