Let $a, b, c$ be three distinct positive integer numbers on a whiteboard. At each step, I choose two of them and I replace one of the two numbers with their arithmetic mean.
For example: I choose $a, b$ and I change $a$ with $\frac{a+b}{2}$. Then we will have $\frac{a+b}{2}, b, c$.
Show that after many steps we can obtain two equal numbers.
I tried a lot of combinations but I didn't succeed. Also I tried to make a program in C++ but I am not good enough.
I'm not $100$% sure about this one (please suggest any improvements), but here it goes:
Out of the three, at least two have the same parity by the Pigeonhole Principle. If all three have the same parity, choose $a$ and $b$. Call the two chosen numbers $x$ and $y$, where $x>y$. The mean is ${x+y}\over2$, which is an integer since they both have the same parity. Again, by the Pigeonhole Principle, at least one of $x$ and $y$ must be an extremum (that is to say, either a maximum or minimum). Replace that with ${x+y}\over2$. (If one is maximum and the other minimum, $y$). Since $x$ and $y$ have the same parity (and they are not equal, otherwise we are done), we have $x-y\ge 2$.
Suppose we chose $x$, then the original triplet was $x,y,z$ in decreasing order (since we chose $x$, it is an extremum, and $x>y$ so it's a max. Since we didn't choose $y$, it isn't a minimum) for some $z$. The new triplet is ${x+y\over2},y,z$. $${x+y\over2}<{x+x\over2} = x$$ since $x>y$. The new triplet still consists of integers, and $x - {x+y\over2} \ge 1$, so the bounds (that is max$(a,b,c)-$min$(a,b,c)$ have decreased by at least $1$. A similar argument works if we choose $y$ (Original - $p,q,y$ - since we don't know whether or not $x$ is the largest, new $p,q,{x+y\over2}$, $y<{x+y\over2}$).
At every step, the bounds decrease by at least $1$ (either due to a decrease in maximum or an increase in minimum). Thus there must come a stage the values are 'squeezed', and either $a=b,b=c$ or $a=c$.
Here is a python code that implements the above algorithm (can someone make the syntax highlighting appear?):
Maybe someone can implement this logic in C++ since I don't know that.