Maths Olympiad Prep

Library / /34 of 97

Number theory Difficulty 7.7 National olympiad, round 2 Find the answer

Two positive integers p,qZ+p,q \in \mathbf{Z}^{+} are given. There is a blackboard with nn positive integers written on it. A operation is to choose two same number a,aa,a written on the blackboard, and replace them with a+p,a+qa+p,a+q. Determine the smallest nn so that such operation can go on infinitely.

A number or a short expression. Spacing and $ signs are ignored.

Solution

Given two positive integers p p and q q , we are to determine the smallest number n n such that the operation of choosing two identical numbers a,a a, a on the blackboard and replacing them with a+p a+p and a+q a+q can go on infinitely.

To solve this, we first note that we can assume gcd(p,q)=1\gcd(p, q) = 1 by scaling, because the problem is invariant under scaling by the greatest common divisor.

We claim that the smallest n n is p+qgcd(p,q)\frac{p+q}{\gcd(p, q)}. When gcd(p,q)=1\gcd(p, q) = 1, this simplifies to p+q p + q .

To see that n=p+q n = p + q is sufficient, consider a board with the set {1,,p}{1,,q}\{1, \dots, p\} \cup \{1, \dots, q\}. This configuration can last forever under the given operation.

We now show that np+q n \ge p + q is necessary. Assume n n is minimal, which implies that every entry is changed infinitely many times. We consider the entire blackboard as generating an infinite table with n n columns, such that each row is obtained from the previous one by replacing a,a a, a with a+p,a+q a+p, a+q (for some a a ), and each column is unbounded.

Without loss of generality, we can assume (by shifting and rearranging) that the first two entries of the first row are 0 0 , and all others are nonnegative. We add the condition that whenever the first column is erased, we increment that entry by p p , and whenever the second column is erased, we increment that entry by q q . Thus, the first column will contain all positive multiples of p p and the second column will contain all positive multiples of q q .

Claim: Let S={p,2p,,(q1)p}{q,2q,,(p1)q} S = \{ p, 2p, \dots, (q-1)p \} \cup \{ q, 2q, \dots, (p-1)q \} . Then for every sS s \in S , there exists a column C C other than the first or second column such that max(SC)=s\max (S \cap C) = s.

Proof: Let tS t \in S and assume pt p \mid t (the other case is similar). Since it is incremented by p p in the first column, there must be some column containing t t followed immediately by t+q t+q . That column then cannot contain any larger elements of S S . Indeed, the next smallest multiples of p p and q q exceeding t+q t+q are t+pq t+pq and pq+q pq+q , respectively. \blacksquare

Hence, the number of columns is at least 2+#S=p+q 2 + \# S = p + q , as needed.

The answer is p+qgcd(p,q)\boxed{\frac{p+q}{\gcd(p,q)}}.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.