Let $n \geq 3$ be a fixed integer. The number $1$ is written $n$ times on a blackboard. Below the blackboard, there are two buckets that are initially empty. A move consists of erasing two of the numbers $a$ and $b$, replacing them with the numbers $1$ and $a+b$, then adding one stone to the first bucket and $\gcd(a, b)$ stones to the second bucket. After some finite number of moves, there are $s$ stones in the first bucket and $t$ stones in the second bucket, where $s$ and $t$ are positive integers. Find all possible values of the ratio $\frac{t}{s}$.
Problem
Source: APMO 2020 Problem 5
Tags: algebra, number theory, APMO, algorithm
09.06.2020 04:38
We claim the answer is \[ \mathbb Q\cap [1, n-1). \]It is clear that $1$ is a lower bound; we now show that $n-1$ is an upper bound. Let the integers be $a_0, \ldots, a_{n-1}$. Add another counter $\texttt{t'}$, initially zero. When we operate, say on $a_i, a_j$ with $i < j$, we perform the following operations: \[ s\texttt{++}, t\texttt{ += }\gcd(a_i, a_j), t'\texttt{ += }a_i \geq \gcd(a_i,a_j). \]It is clear that $t' \geq t$ always, so we will show that $t' < (n-1)s$ (assuming both are positive). For each $i$, place a pile of stones, one black and $a_i-1$ pink, below $a_i$. Then, when we perform the operation, we color all stones in $P_i$ pink and move them to $P_j$, and then add a black stone to $P_i$. Furthermore, for each stone $r$, we associate a score $\operatorname{sc}(r)$, the number of times it has been moved. $s$ counts the number of pink stones, $t'$ counts the total score. Thus, since black stones have a score of zero, $t'/s$ counts the average score of the pink stones. Indeed, note that each stone has a score of at most $n-1$, since it always moves to the right. So, $t' \leq s(n-1)$. To show that equality cannot hold, simply suppose that all the pink stones have score $n-1$, so that they are all in $P_{n-1}$, then our last operation was applied to $a_i$ and $a_{n-1}$, meaning that a black stone was turned pink in the process and thus has score one. Thus, \[ t \leq t' < (n-1)s \iff t/s < n-1. \]To show the lower bound, we will first show that we can get $t/s$ arbitrarily close to $n-1$ for arbitrarily large $s$. For $m \geq 0$, $n \geq 2$, define the following algorithm as follows: If $m = 0$, do nothing. If $n = 2$, do \[ (1, 1)\to (1, 2)\to (1, 3), \ldots, \to (1, 2^m). \] For $m > 0, n > 2$, first run $A(m-1, n)$ to get \[ \underbrace{1, 1, \ldots, 1}_{n-1\, 1\text{'s}}, 2^{m-1}, \]then run $A(m-1, n-1)$ on the first $n-1$ numbers to get: \[ \underbrace{1, 1, \ldots, 1,}_{n-2\, 1\text{'s}} 2^{m-1}, 2^{m-1}. \] Let $f(m,n)$ be the final value of $t$ after running $A(m,n)$, and let $g(m,n) = f(m,n)/2^m$, then it will suffice to show that \[ \lim_{m\to \infty} g(m,n) = n-1 \]for each $n$. Indeed, note that \[ g(m,2) = 1-\frac{1}{2^m}, \]so it is true for $n = 2$. For $n > 2, m > 0$, we have \[ g(m,n) = \frac{g(m-1, n-1) + g(m-1, n) + 1}{2}, \]so since for large $m$, $g(m-1,n-1)\to n-2$, we have \[ g(m,n) = \frac{n-1 + g(m-1,n)}{2} + k(m), \]where $k\to 0$ as $m\to \infty$. In particular, since $g(m,n) < n-1$ for all $n$ from the upper bound, it suffices to show that $g(m,n) > n-1-\varepsilon$ for sufficiently large $m$. Indeed, once $k <\frac{\varepsilon}{2}$, we will have that the distance from $g(m,n)$ to $n-1-\frac{\varepsilon}{2}$ is at least halved each time $m$ increments, so $g(m,n)$ will get to $n-1$. Now, let $1\leq q = a/b < n-1$. If $a=b$ then we can clearly reach $q$. Else, let $a-b = c > 0$, and pick $m$ so that \[ g(m,n) > \frac{1000(n-1) + q}{1001}, m \gg c, \]then first apply $A(m,n)$, and then we will have $s = 2^m-1$, $t = f(m,n)$. Next, run \[ 1, \ldots, 1, 2k \to 1, \ldots, 1, 2, 2^m \to 1, \ldots, 1, 2k+2, \]repeatedly incrementing $t$ by $3$ and $s$ by $2$, and do this a total of $r < c$ times until $c\mid t-s$. We will still have $t/s > q$. Then, just do $1, 1\to 1, 2 \to 1, 3 \to\cdots$ until we get to $q$. To see that this always works, note that we want: \[ \frac{t+\ell}{s+\ell} = \frac ab \iff \ell = \frac{t-s}{a-b}\cdot b - s, \]which is always positive since $\frac ts > \frac ab$ and is an integer since $a-b\mid t-s$. Thus, after we get to $1, 1, \ldots, 1, \ell, 2k$, we will reach $t/s = q$ as desired.
09.06.2020 21:21
This strategy eventually stops working when all the values on the board are distinct. and I managed to do $1048555$ steps, with a maximal ratio of $9.50001811984$ Maximal ratio it achieves with n is roughly $\frac {(n-1)}{2}. $ What it actually achieves $\frac {(n-1)}{2}+\epsilon_n. $ $\epsilon_n$ seems to go to 0 as $n\mapsto\infty. $ Basically the board would look like this $$1 1 1 1... 1 1 1 2... 1 1 2 2... 1 1 1 4... 1 1 2 4... 1 2 2 4... 1 1 4 4... 1 1 1 8...$$so on. Following it symmetrically after $2^{n-1}-1$ steps, the board looks like this $1 1 1 1 1 1\hdots 1 1 1 2^{n-1}$ With same strategy we get the board $1, 2, 4 ,8,\hdots 2^{n-3}, 2^{n-2}, 2^{n-1}$ For $n=8$ For $n=8$ the ratio is $\frac { 32}{15} (\pm 2.13)$ If we write down the blackboard as a list of $\mathrm{1's} $ initially. Each move is an ordered pair of choices of which entries you pick as $a$ and $b.$ This is the sequence of moves $$[[0,1],[0,2],[1,2],[0,1],[0,3],[1,3],[2,3],[4,5],[4,6],[5,6],[4,5],[4,7],[5,7],[6,7],[3,7]]$$Basically, add $1$ and $1$ to get $2.$ Doing this twice, then add $2$ and $2$ get $4$ and the $\gcd=2. $ Doing this twice, I have $2$ $\mathrm {4's}. $ Add them, get $8,$ the $\gcd=4.$ Each step adds $1$ to the sum of the numbers written on the board. Since the first board where $2^k$ appears looks like $1 1 1 1 2^k 1 1 1\hdots 1 1,$ It takes $2^k-1$ steps to reach this board. When this board is reached, $2^{k-1}$ is the gcd of the previous values of $a$ and $b.$ The $\gcd\text {s}$ were $2^{k-2}= 2\,\text { times}\, 2^{k-3}=4\,\text {times}\, \hdots 2^{k-l}= 2^{L-1}\,\text{times}$ If we add up all the $\gcd\text {s},$ there are $\sum{L=1}^k 2^{L-1} * 2^{k-L}$ Stones in the second bucket. This is $=k\cdot 2^{k-1}. $ In the first bucket, there's $\sum{L=1}^k 2^{L-1} = 1 + 2 + 4 +\hdots + 2^{k-1} = 2^k - 1$ stones. So the ratio of the buckets at the $2^k-1\,\text {th} $ step is $\frac {\left(k2^{k-1}\right)}{(2^k-1)} $ Also fun fact of this strategy We can reach the $2^k$ value on the board if $k\le n,$ because you only get powers of $2$ on the board, so as soon as two powers of two on the board are equal, you can bubble up to the highest power of $2. $ So that at most one pair of powers of two is equal at the same time. $\left (k * 2^{k-1}\right)(2^k-1) = (\tfrac k2) \left(\frac {2^k}{(2^k-1)}\right) = (\tfrac k2)\left(1 +\frac{1}{(2^k-1)}\right)$ So basically this proves that the maximal ratio is greater than $\left(\frac {(n-1)}{2}\right)*\left( 1 +\frac {1}{(2^{n-1}-1)}\right).$
15.06.2020 16:07
First we show that ratios $\frac{t}{s}$ can be made arbitrarily close to $n-1$ , and with some addional steps we can attain any rational in $[1,n-1)$ For $n\ge 2$ name $P_n $ the procedure that takes $n$ buckets from state $(1,1,1,...,1)$ to state $(1,1,1,...,1,2^k)$ for some $k$ and therefore adds $2^k-1$ to $s$ and adds $(n-1)2^k-q_n(k)$ to $t$ for some polynomial $q_n$ of degree $n-2$. For $n=2 $ it is the obvious one $(1,1)\to (1,2) \to...\to(1,2^k)$ and $q_2=1$ .We construct $P_n$ inductively , when having $n$ buckets in initial state do the following: $(1,1,...,1,1)\to (1,1,...1,2)\to (1,1,...,2,2)\to (1,1,...,1,4) \to .....\to (1,1,...,1,2^{k-1})\to $(do procedure $P_{n-1}$ on the first $n-1$ buckets) $\to (1,1,...,2^{k-1},2^{k-1}) \to (1,1,...,1,2^k)$ It is easy to see that in total we added $2^k-1$ to $s$ and $\sum_{m=0}^{k-1}(n-2)2^{m}-q_{n-1}(m)+2^m=(n-1)2^k-q_n(k)$ to $t$. The ratio $\frac{(n-1)2^k-q_n(k)}{2^k-1}$ clearly tends to $n-1$. Now we show that this ratio is at all times less than $n-1$. Note that $(a,b)\le min(a,b)$ .Instead of taking two buckets adding the stones from the one to the other and then adding $1$ stone to the former , $(1)$ we move $1$ stone at a time from a bucket with $a$ stones to a bucket with $b$ stones only if $a\le b$ and can at any time $(2)$ take $1$ stone from an infinite supply of stones and add it in any bucket. Move $(1)$ adds $1$ to $t$ whereas move $(2)$ adds $1$ to $s$ which basically is the total number of stones minus $n$. The state $m$ of a bucket $i$ with $a_i$ stones(and furthermore the state of these stones) is the size of maximum strictly increasing sequence of other buckets with $b_1<...<b_m<a_i$that has appeared . In the beginning all buckets are in ground state $0$ and they can reach any state $0,1,2,...,n-1$ . If the game is played in such a way that stones only increase their state in a move then we are done cause then every stone would move at most $n-1$ times which impllies that the total number of moves is less that $n-1$ times the total number of stones. We can ensure this by imposing the following : if a bucket $ i $ has at some time more stones than another bucket $j$ (and higher state ) then $B_j$ has higher priority than $B_i$ to receive stones (therefore if at some time $|B_i|=|B_j|$ any stone goes to $B_i$) and stones go to the bucket with higher priority . So $B_j$ will never contain more stones than $B_i$ and no stone will ever move from $B_i$ to $B_j$ .
06.03.2023 01:32
Answer is all rationals at least $1$ and less than $n - 1$. For proof, simply require that each location be assigned a label $k$ and the operations replaces the lower labelled with 1 always. Let the numbers be $a_1, a_2, \ldots, a_n$, then simply consider the monovariant $(n-2)a_1+(n-2)a_2+\ldots+a_{n-1}$. For each operation, this value changes by at most $(n-1) - gcd(a, b)$ and must stay at least its initial value, so it follows the fraction $\frac{t}{s}$ is less than $n-1$ (first operation is wasted). For construction, simply go $(1, 1, 1, 1) \to (1, 10, 1, 1), \to (1, 10, 100, 1) \to (1, 10, 100, 1000) \to (10, 10, 100, 1000) \to (1, 20, 100, 1000) \to \ldots \to (1, 100, 100, 1000) \to (1, 1, 200, 1000) \to (1, 10, 200, 1000) \to (10, 10, 200, 1000) \to (1, 20, 200, 1000) \to (1, 100, 200, 1000) \to (1, 1, 300, 1000) \to \ldots \to (1, 1, 1000, 1000) \to (1, 1, 1, 2000) \to (1, 10, 1, 2000) \to (1, 10, 100, 2000) \to \ldots$. Now take $10 \to \infty$ and at the end waste time with $(1 ,1, n) \to (1, 1, n+1)$ or with $(1, 1, 2n) \to (1, 2, 2n) \to (1, 1, 2n+2)$ to get the exact desired fraction.
23.05.2023 14:50
Solved with AdhityaMV The answer is all rationals at least $1$ and less than $n-1$. First, we prove that the ratio is always less than $n-1$. Number the numbers on the blackboard from $1$ to $n$. Impose the additional condition that the number to the left always gets replaced with a $1$. If the numbers are $a_1, a_2, \cdots, a_n$ in that order, define the weight of the board to be $W = \sum_{i=1}^n ia_i$. Now, suppose we operated on numbers $i$ and $j$, and they had $a$ and $b$ on them. Then the initial contribution to the weight was $ia + jb$. After the operation, the new contribution is $i + ja + jb$, so an increase $W' = (j-i)a + i \geqslant a + 1 \geqslant \gcd(a,b) + 1 = t' + s'$, the increases to $t$ and $s$. Adding up all such inequalities, at the end we get that $W \geqslant t + s$. But note that $s = \sum_{i=1}^n a_i - n$ and $W = \sum_{i=1}^n ia_i < n \left(\sum_{i=1}^n a_i \right) < ns$. So $t+s \leqslant W < ns \implies \frac{t}{s} < n-1$, as claimed. Next, we show it is possible to construct ratios arbitrarily close to $n-1$. By induction, it is possible to make the first $n-2$ numbers all ones, the $n-1$st number to be some $M$ with $\frac{t}{s}$ ratio arbitrarily close to $n-2$, let them be $T$ and $S$ (Note $S$ is just $M-1$). Now, begin by using the operation on the first and last number $M-1$ times. Then by induction create $M$ at the $n-1$st place. Then, operate on the last two numbers. Then repeat this process again and again. So after $k$ iterations of this, we are left with the number $kM$ on the rightmost and all others ones. The value of $t$ is $M-1 + kT + (k-1)M$. The value of $s$, since the sum increases by $1$ for every operation, is $kM - 1$. So the new value of $\frac{t}{s} = \frac{M-1 + kT + (k-1)M}{kM - 1} > \frac{kT}{kM - 1} + \frac{(k-1)M}{kM - 1}$. By induction, the first fraction can be made arbitrarily close to $n-2$. Taking $k $ sufficiently large, the second fraction can be made arbitrarily close to $1$. So the total gets arbitrarily close to $n-1$, as desired. Finally, we show how to generate any ratio using these. Assume the base case $n = 3$ is proven. Suppose we wish to generate a ratio $\frac{p}{q}$. We will show a solution to $x+a = tp$ and $y+b = tq$ exists for a positive integer $t$ and such that $\frac{x}{y}$ is a fixed fraction arbitrarily close to $n-1$ and $\frac{a}{b}$ is some ratio at most $n-2$. This will suffice since then we use whatever method to generate the $x,y$ ratio and then ignore the last number and by induction add $a,b$ ratio things to it. We need $a \geqslant b$ so $tp-x \geqslant tp-y \implies t \geqslant \frac{x-y}{p-q}$. Let $k = n-2$. The condition $\frac{a}{b} < k$ translates to $t < \frac{x-ky}{p-kq}$. If the difference between the upper and lower bounds is at least $1$, then we can ensure an integral solution in $t$. For this, we require that $\frac{x-ky}{p-kq} - \frac{x-y}{p-q} > 1$ which becomes $qy(k-1) \left(\frac{x}{y} - \frac{p}{q} \right) > (p-q)(p-kq)$. If $p - kq < 0$, we were already done by induction. Also $n \geqslant 4$ so $k-1 = n-3 > 0$. Since we can make $\frac{x}{y}$ to be arbitrarily close to $n-1$, we can pick such that the difference with $\frac{p}{q}$ is at least some fixed constant and pick such that $y$ is forced to become sufficiently large. This finishes since the RHS is fixed and the LHS is becoming big enough. So it suffices to show it for the base case $n = 3$. Using the same strategy as mentioned above, gives us an explicit ratio of $\frac{t}{s} = \frac{m+(2m+1)k}{m+(m+1)k}$. Also we can waste time at the end operating only on ones, so we can make the ratio $\frac{t}{s} = \frac{m+(2m+1)k+C}{m+(m+1)k+C}$. Then $2 - \frac{t}{s} = \frac{m+k+C}{m+(m+1)k+C}$ which we need to show can take any rational value between $0$ and $1$. But observe that this is just all fractions of the form $\frac{p}{q}$ such that $p \geqslant 2\sqrt{q-p}$. But for any rational $\frac{a}{b}$, we can find a $t$ such that $ta \geqslant 2 \sqrt{tb-ta}$. Therefore $\frac{ta}{tb}$ can be written in this form, giving that $\frac{a}{b}$ can be written in this form, so we're done with the base case, and the induction holds. $\blacksquare$
01.10.2023 21:07
The answer is all rational numbers in $[1,n-1)$. Clearly $1$ is a lower bound and the answer is rational. I will probe that $n-1$ is a (strict) upper bound. Reinterpret the problem as follows: we are given $n$ boxes which initially contain one stick each. During a move, we select a left and a right box, move all the sticks from the left box to the right box, and then place one stick into the left box. If we move $k$ sticks, then we add one stone to the first bucket and $k$ sticks to the second. Clearly this results in at least as many stones being added to the second bucket as before; I will prove that even in this case $t/s<n-1$. Suppose we halt after $m$ operations, so there are $m+n$ sticks present. Double-counting, the number of stones in the second bucket is at most the sum of the difference between starting and ending positions, summed over all sticks. Since every box must have at least one stick at all times, it follows that this difference is at most $m(n-1)$, which implies $t/s \leq n-1$. Moreover, equality only holds if all but $n-1$ sticks end in the rightmost box, and $m$ of the sticks in the rightmost box have each moved all the way from the leftmost to rightmost box, one at a time (one stick in the rightmost box must have been there from the very start)—that is, every stick has moved either $0$ or $n-1$ times. On the other hand, for any box $1<i<n$, if we ever move with $i$ as the left box, then the stick that originally started at box $i$ must have moved at least once, but also cannot have moved $n-1$ times, so we only move from box $1$ to $n$. However, this clearly results in $t/s=1$, hence this inequality is strict. Since $t/s=1$ is obviously achievable, I will now show that any $1<t/s<n-1$ is possible. First go from $(1,\ldots,1)$ to $(1,1,a,\ldots,a^{k-2})$, always picking a number equal to $1$. Suppose this $C$ stones each into both buckets. Now set $k=1$ and consider the series of operations \begin{align*} (1,1,a,a^2,\ldots,ka^{n-2}) &\to (1,2,a,a^2,\ldots,ka^{n-2}) \to \cdots \to (1,a,a,a^2,\ldots,ka^{n-2})\to\\ (1,1,2a,a^2,\ldots,ka^{n-2})&\to \cdots \to (1,1,a^2,a^2,\ldots,ka^{n-2}) \to (1,1,1,2a^2,\ldots,ka^{n-2}) \to\\ (1,1,a,2a^2,\ldots,ka^{n-2}) &\to \cdots \to (1,\ldots,1,(k+1)a^{n-2}) \to \cdots \to (1,1,a,a^2,\ldots,(k+1)a^{n-2}). \end{align*}Then repeat for $k=2,3,\ldots$. For $n=4,a=3,k=2$, explicitly written out, this is $$(1,1,3,18) \to (1,2,3,18) \to (1,3,3,18) \to (1,1,6,18) \to (1,2,6,18) \to (1,3,6,18) \to (1,1,9,18) \to (1,1,1,27) \to (1,1,2,27) \to (1,1,3,27).$$For each iteration, $P(a):=a^{n-2}$ stones are put into the first bucket, and there exists some fixed polynomial $Q(x)$ with leading term $(n-1)x^{n-2}$ such that $Q(a)$ stones are put into the second bucket. Suppose we repeat this a total of $M$ times. Then we waste $N$ moves by selecting the first two numbers, adding one stone into each bucket per wasted move. The final value of $t/s$ equals $$\frac{C+MQ(a)+N}{C+MQ(b)+N}.$$We solve: $$\frac{C+MQ(a)+N}{C+MP(a)+N}=\frac{p}{q} \iff Cq+MqQ(a)+Nq=Cp+MpP(a)+Np \iff N(p-q)=M(qQ(a)-pP(a))+C(q-p) \iff N=\frac{M(qQ(a)-pP(a))}{p-q}-C.$$If $1<p/q<n-1$, then take $a \to \infty$ so that $qQ(a)-pP(a)>0$, and then select $M$ to be a large positive integer multiple of $p-q$, which yields a positive integer value for $N$. Therefore for any such $p/q$ we can perform some series of operations such that $t/s=p/q$, finishing the problem. $\blacksquare$