7

QUESTION: Several positive integers are written on a blackboard. One can erase any two distinct integers and write their greatest common divisor and least common multiple instead. Prove that eventually the numbers will stop changing.


MY ANSWER: I came across this question lately.. and I progressed upto some extent after which I couldn't think further. As we know,

LCM$×$HCF= product of the numbers. So applying that concept we can see that the product of the numbers never changes on the blackboard. But how do I prove that the numbers themselves will stop changing?

Any help is highly appreciated. Thank you.

Bill Dubuque
  • 282,220

4 Answers4

10

Assume that you make a change by choosing $a$ and $b$. WLOG if $a \leqslant b$, then $\gcd(a,b) \leqslant a \leqslant b \leqslant \text{lcm}(a,b)$. As $\gcd(a,b) \cdot \text{lcm}(a,b) = ab$, it is not hard to see that $\gcd(a,b)+\text{lcm}(a,b) > a+b$ in case of an actual change. This means that a change increases the sum of all the numbers on the board.

Now, assume that the numbers on the blackboard actually change infinitely often. For each change, we make the sum of the numbers on the board bigger since the sum of the GCD and LCM will be greater than the sum of the two numbers. However, if there are infinitely many changes, then the sum of the numbers will go off to $\infty$. Can this happen?


If the sum goes off to $\infty$, then the largest number must go off to $\infty$ as well. Obviously this is false as the product of all the numbers is constant and finite.

Bill Dubuque
  • 282,220
Haran
  • 11,978
  • 1
  • 19
  • 56
0

If a step makes a change, then $\gcd(a,b)+\operatorname{lcm}(a,b)<a+b$ (why?)

0

Let $S=\{a_i:i\in[n]\}$ be the given multiset of numbers. Count the pairs of these numbers that are comparable by the divisibility partial order: $$d=\bigl|\bigl\{\{i,j\}\in\tbinom{[n]}2:a_i\mid a_j\bigr\}\bigr|.$$

Whenever we replace $a_i,a_j$ with $\gcd(a_i,a_j),\DeclareMathOperator\lcm{lcm}\lcm(a_i,a_j)$ and this actually changes $S$, the integer $d$ strictly increases:

  • Since the set is changed, $a_i$ and $a_j$ cannot divide each other, but $\gcd(a_i,a_j)\mid\lcm(a_i,a_j)$. So this accounts for an increase of $d$ by $1$.

  • For any $k\ne i,j$, if $a_k$ is comparable to one of $a_i,a_j$, then it is comparable to $\gcd(a_i,a_j)$ (if it is divisible by $a_i$ or $a_j$) or to $\lcm(a_i,a_j)$ (if it divides $a_i$ or $a_j$).

  • If $a_k$ is comparable to both $a_i$ and $a_j$, say, $a_k\mid a_i,a_j$, then $a_k\mid\gcd(a_i,a_j),\lcm(a_i,a_j)$. Likewise if $a_i,a_j\mid a_k$. We cannot have $a_i\mid a_k\mid a_j$ or vice versa, as $a_i$ and $a_j$ are incomparable.

Since $d\le\binom n2$, this process must stop after at most $\binom n2$ steps; in the end, the numbers will be linearly (pre-)ordered by divisibility. This bound is tight (e.g., start with $S=\{pq^n,p^2q^{n-1},\dots,p^nq\}$ for two primes $p\ne q$, and process it in a bubble-sort-like fashion).

  • Another intriguing question is for a given $n$, what is the smallest $s$ with the property that for every multiset of $n$ natural numbers, there exists a sequence of at most $s$ replacement steps that stabilizes. The answer is that this is exactly the minimal size of a sorting network on $n$ inputs. Thus, $s=\Theta(n\log n)$ (the well known general $\Omega(n\log n)$ lower bound on comparison sorting applies here; for an $O(n\log n)$ upper bound, one can use the Ajtai–Komlós–Szemerédi network or the Goodrich network). – Emil Jeřábek May 14 '25 at 13:03
0

Every positive integer has a unique prime factorization. For sake of notation let $P_n$ be the set of prime factors of $n$ and let $a_{n,p}$ be the power so that $p^{a_{n,p}}\mid n$ but $p^{a_{n,p}+1}\not \mid n$. (If $p\not \mid n$ [or in other words if $p\not\in P_n$; we will assume $a_{n,p} = 0$). By our notation $n = \prod\limits_{p\in P_n} p^{a_{n,p}}$.

Therefore if $d=\gcd(m,n)$ then $P_d=P_m\cap P_n$ and $a_{p,d} = \min(a_{p,m},a_{p,n})$ and $d = \prod\limits_{p\in P_m\cap P_n} p^{\min(a_{m,p},a_{n,p})}$. And if $e=\operatorname{lcm}(m,n)$ then $P_d=P_m\cup P_n$ and $a_{p,d} = \max(a_{p,m},a_{p,n})$ and $d = \prod\limits_{p\in P_m\cup P_n} p^{\max(a_{m,p},a_{n,p})}$.

If our original set of integers are $\{n_k\}$ let consider what selecting $n_i$ and $n_j$ and replacing them with "new" $n_i = \gcd(n_i, n_j)$ and "new" $n_j= \operatorname{lcm}(n_i,n_j)$ means. It means replacing $P_{n_i}$ with "new $P_{n_i} = P_{n_i}\cap P_{n_j}$ and replacing $P_{n_j}$ with "new" $P_{n_j}=P_{n_i}\cap P_{n_j}$, and replacing each $a_{n_i,p}$ with "new" $a_{n_i,p}=\min(a_{n_i,p},a_{n_j,p})$ and replacing each $a_{n_j,p}$ with "new" $a_{n_j,p}= \max(a_{n_i,p},a_{n_j,p})$.

Each combination is going to result in greatest common divisor whose set of prime factors will be an intersection of existing finite sets and whose powers will be a minimum of powers and in a least common multiple whose set of prime factors will be a union of existing finite sets and whose powers will by maximum of existing powers.

After all possible combinations we will result in multiple interations of two numbers: $N$ whose prime factors are $P_N = \cap P_{n_k}$ and whose powers are $\min(a_{n_k, p})$ for each $p\in \cap P_{n_k}$ so $N = \prod\limits_{p\in \cap P_{n_k}}p^{\min(a_{n_k},p} = \gcd(n_k)$; and $M$ whose prime factors are $P_M = \cup P_{n_k}$ and whose powers are $\max(a_{n_k, p})$ for each $p\in \cap P_{n_k}$ so $M = \prod\limits_{p\in \cup P_{n_k}}p^{\max(a_{n_k},p} = \operatorname{lcm}(n_k)$

fleablood
  • 130,341