The $10^{\text {th }}$ Romanian Master of Mathematics Competition
Day 2 - Solutions
Problem 4. Let $a, b, c, d$ be positive integers such that $a d \neq b c$ and $\operatorname{gcd}(a, b, c, d)=1$. Prove that, as $n$ runs through the positive integers, the values $\operatorname{gcd}(a n+b, c n+d)$ may achieve form the set of all positive divisors of some integer.
Raul Alcantara, Peru
Solution 1. We extend the problem statement by allowing $a$ and $c$ take non-negative integer values, and allowing $b$ and $d$ to take arbitrary integer values. (As usual, the greatest common divisor of two integers is non-negative.) Without loss of generality, we assume $0 \leq a \leq c$. Let $S(a, b, c, d)=\left{\operatorname{gcd}(a n+b, c n+d): n \in \mathbb{Z}_{>0}\right}$.
Now we induct on $a$. We first deal with the inductive step, leaving the base case $a=0$ to the end of the solution. So, assume that $a>0$; we intend to find a 4 -tuple $\left(a^{\prime}, b^{\prime}, c^{\prime}, d^{\prime}\right)$ satisfying the requirements of the extended problem, such that $S\left(a^{\prime}, b^{\prime}, c^{\prime}, d^{\prime}\right)=S(a, b, c, d)$ and $0 \leq a^{\prime}<a$, which will allow us to apply the induction hypothesis.
The construction of this 4 -tuple is provided by the step of the Euclidean algorithm. Write $c=a q+r$, where $q$ and $r$ are both integers and $0 \leq r<a$. Then for every $n$ we have
so a natural intention is to define $a^{\prime}=r, b^{\prime}=d-q b, c^{\prime}=a$, and $d^{\prime}=b$ (which are already shown to satisfy $S\left(a^{\prime}, b^{\prime}, c^{\prime}, d^{\prime}\right)=S(a, b, c, d)$ ). The check of the problem requirements is straightforward: indeed,
and
Thus the step is verified. It remains to deal with the base case $a=0$, i.e., to examine the set $S(0, b, c, d)$ with $b c \neq 0$ and $\operatorname{gcd}(b, c, d)=1$. Let $b^{\prime}$ be the integer obtained from $b$ by ignoring all primes $b$ and $c$ share (none of them divides $c n+d$ for any integer $n$, otherwise $\operatorname{gcd}(b, c, d)>1)$. We thus get $\operatorname{gcd}\left(b^{\prime}, c\right)=1$ and $S\left(0, b^{\prime}, c, d\right)=S(0, b, c, d)$.
Finally, it is easily seen that $S\left(0, b^{\prime}, c, d\right)$ is the set of all positive divisors of $b^{\prime}$. Each member of $S\left(0, b^{\prime}, c, d\right)$ is clearly a divisor of $b^{\prime}$. Conversely, if $\delta$ is a positive divisor of $b^{\prime}$, then $c n+d \equiv \delta$ $\left(\bmod b^{\prime}\right)$ for some $n$, since $b^{\prime}$ and $c$ are coprime, so $\delta$ is indeed a member of $S\left(0, b^{\prime}, c, d\right)$.
Solution 2. (Alexander Betts) For positive integers $s$ and $t$ and prime $p$, we will denote by $\operatorname{gcd}_{p}(s, t)$ the greatest common $p$-power divisor of $s$ and $t$. Claim 1. For any positive integer $n, \operatorname{gcd}(a n+b, c n+d) \mid a d-b c$. Proof. This is clear from the identity
Claim 2. The set of values taken by $\operatorname{gcd}(a n+b, c n+d)$ is exactly the set of values taken by the product
as the $\left(n_{p}\right)_{p \mid a d-b c}$ each range over positive integers.
Proof. From the identity
it is clear that every value taken by $\operatorname{gcd}(a n+b, c n+d)$ is also a value taken by the product (with all $n_{p}=n$ ). Conversely, it suffices to show that, given any positive integers $\left(n_{p}\right){p \mid a d-b c}$, there is a positive integer $n$ such that $\operatorname{gcd}{p}(a n+b, c n+d)=\operatorname{gcd}{p}\left(a n{p}+b, c n_{p}+d\right)$ for each $p \mid a d-b c$. This can be achieved by requiring that $n$ be congruent to $n_{p}$ modulo a sufficiently large ${ }^{1}$ power of $p$ (using the Chinese Remainder Theorem).
Using Claim 2, it suffices to determine the sets of values taken by $\operatorname{gcd}_{p}(a n+b, c n+d)$ as $n$ ranges over all positive integers. There are two cases.
Claim 3. If $p \mid a, c$, then $\operatorname{gcd}{p}(a n+b, c n+d)=1$ for all $n$. Proof. If $p \mid a n+b, c n+d$, then we would have $p \mid a, b, c, d$, which is not the case. Claim 4. If $p \nmid a$ or $p \nmid c$, then the values taken by $\operatorname{gcd}{p}(a n+b, c n+d)$ are exactly the $p$-power divisors of $a d-b c$. Proof. Assume without loss of generality that $p \nmid a$. Then from identity $(\dagger)$ we have $\operatorname{grd}{p}(a n+$ $b, c n+d)=\operatorname{gcd}{p}(a n+b, a d-b c)$. But since $p \nmid a$, the arithmetic progression $a n+b$ takes all possible values modulo the highest $p$-power divisor of $a d-b c$, and in particular the values taken by $\operatorname{gcd}_{p}(a n+b, a d-b c)$ are exactly the $p$-power divisors of $a d-b c$. Conclusion. Using claims 2,3 and 4 , we see that the set of values taken by $\operatorname{gcd}(a n+b, c n+d)$ is equal to the set of products of $p$-power divisors of $a d-b c$, where we only consider those primes $p$ not dividing $\operatorname{gcd}(a, c)$. Thus the set of values of $\operatorname{gcd}(a n+b, c n+d)$ is equal to the set of divisors of the largest factor of $a d-b c$ coprime to $\operatorname{gcd}(a, c)$.
Remarks. (1) If $S(a, b, c, d)$ is the set of all positive divisors of some integer, then necessarily $a d \neq b c$ and $\operatorname{gcd}(a, b, c, d)=1$ : finiteness of $S(a, b, c, d)$ forces the former, and membership of 1 forces the latter. (2) One may modify the problem statement according to the first paragraph of the solution. However, it seems that in this case one needs to include a clarification of the agreement on gcd being necessarily non-negative.
Problem 5. Let $n$ be a positive integer and fix $2 n$ distinct points on a circumference. Split these points into $n$ pairs and join the points in each pair by an arrow (i.e., an oriented line segment). The resulting configuration is good if no two arrows cross, and there are no arrows $\overrightarrow{A B}$ and $\overrightarrow{C D}$ such that $A B C D$ is a convex quadrangle oriented clockwise. Determine the number of good configurations.
Fedor Petrov, Russia Solution 1. The required number is $\binom{2 n}{n}$. To prove this, trace the circumference counterclockwise to label the points $a_{1}, a_{2}, \ldots, a_{2 n}$.
Let $\mathcal{C}$ be any good configuration and let $O(\mathcal{C})$ be the set of all points from which arrows emerge. We claim that every $n$-element subset $S$ of $\left{a_{1}, \ldots, a_{2 n}\right}$ is an $O$-image of a unique good configuration; clearly, this provides the answer.
To prove the claim induct on $n$. The base case $n=1$ is clear. For the induction step, consider any $n$-element subset $S$ of $\left{a_{1}, \ldots, a_{2 n}\right}$, and assume that $S=O(\mathcal{C})$ for some good configuration $\mathcal{C}$. Take any index $k$ such that $a_{k} \in S$ and $a_{k+1} \notin S$ (assume throughout that indices are cyclic modulo $2 n$, i.e., $a_{2 n+1}=a_{1}$ etc.).
If the arrow from $a_{k}$ points to some $a_{\ell}, k+1<\ell(<2 n+k)$, then the arrow pointing to $a_{k+1}$ emerges from some $a_{m}, m$ in the range $k+2$ through $\ell-1$, since these two arrows do not cross. Then the arrows $a_{k} \rightarrow a_{\ell}$ and $a_{m} \rightarrow a_{k+1}$ form a prohibited quadrangle. Hence, $\mathcal{C}$ contains an arrow $a_{k} \rightarrow a_{k+1}$.
On the other hand, if any configuration $\mathcal{C}$ contains the arrow $a_{k} \rightarrow a_{k+1}$, then this arrow cannot cross other arrows, neither can it occur in prohibited quadrangles.
Thus, removing the points $a_{k}, a_{k+1}$ from $\left{a_{1}, \ldots, a_{2 n}\right}$ and the point $a_{k}$ from $S$, we may apply the induction hypothesis to find a unique good configuration $\mathcal{C}^{\prime}$ on $2 n-2$ points compatible with the new set of sources (i.e., points from which arrows emerge). Adjunction of the arrow $a_{k} \rightarrow a_{k+1}$ to $\mathcal{C}^{\prime}$ yields a unique good configuration on $2 n$ points, as required.
Solution 2. Use the counterclockwise labelling $a_{1}, a_{2}, \ldots, a_{2 n}$ in the solution above. Letting $D_{n}$ be the number of good configurations on $2 n$ points, we establish a recurrence relation for the $D_{n}$. To this end, let $C_{n}=\frac{(2 n)!}{n!(n+1)!}$ the $n$th Catalan number; it is well-known that $C_{n}$ is the number of ways to connect $2 n$ given points on the circumference by $n$ pairwise disjoint chords.
Since no two arrows cross, in any good configuration the vertex $a_{1}$ is connected to some $a_{2 k}$. Fix $k$ in the range 1 through $n$ and count the number of good configurations containing the arrow $a_{1} \rightarrow a_{2 k}$. Let $\mathcal{C}$ be any such configuration.
In $\mathcal{C}$, the vertices $a_{2}, \ldots, a_{2 k-1}$ are paired off with one other, each arrow pointing from the smaller to the larger index, for otherwise it would form a prohibited quadrangle with $a_{1} \rightarrow a_{2 k}$. Consequently, there are $C_{k-1}$ ways of drawing such arrows between $a_{2}, \ldots, a_{2 k-1}$.
On the other hand, the arrows between $a_{2 k+1}, \ldots, a_{2 n}$ also form a good configuration, which can be chosen in $D_{n-k}$ ways. Finally, it is easily seen that any configuration of the first kind and any configuration of the second kind combine together to yield an overall good configuration.
Thus the number of good configurations containing the arrow $a_{1} \rightarrow a_{2 k}$ is $C_{k-1} D_{n-k}$. Clearly, this is also the number of good configurations containing the arrow $a_{2(n-k+1)} \rightarrow a_{1}$, so
To find an explicit formula for $D_{n}$, let $d(x)=\sum_{n=0}^{\infty} D_{n} x^{n}$ and let $c(x)=\sum_{n=0}^{\infty} C_{n} x^{n}=$ $\frac{1-\sqrt{1-4 x}}{2 x}$ be the generating functions of the $D_{n}$ and the $C_{n}$, respectively. Since $D_{0}=1$, relation ( $*$ ) yields $d(x)=2 x c(x) d(x)+1$, so
Consequently, $D_{n}=\binom{2 n}{n}$. Solution 3. Let $C_{n}=\frac{1}{n+1}\binom{2 n}{n}$ denote the $n$th Catalan number and recall that there are exactly $C_{n}$ ways to join $2 n$ distinct points on a circumference by $n$ pairwise disjoint chords. Such a configuration of chords will be referred to as a Catalan n-configuration. An orientation of the chords in a Catalan configuration $\mathcal{C}$ making it into a good configuration (in the sense defined in the statement of the problem) will be referred to as a good orientation for $\mathcal{C}$.
We show by induction on $n$ that there are exactly $n+1$ good orientations for any Catalan $n$-configuration, so there are exactly $(n+1) C_{n}=\binom{2 n}{n}$ good configurations on $2 n$ points. The base case $n=1$ is clear.
For the induction step, let $n>1$, let $\mathcal{C}$ be a Catalan $n$-configuration, and let $a b$ be a chord of minimal length in $\mathcal{C}$. By minimality, the endpoints of the other chords in $\mathcal{C}$ all lie on the major $\operatorname{arc} a b$ of the circumference.
Label the $2 n$ endpoints $1,2, \ldots, 2 n$ counterclockwise so that ${a, b}={1,2}$, and notice that the good orientations for $\mathcal{C}$ fall into two disjoint classes: Those containing the arrow $1 \rightarrow 2$, and those containing the opposite arrow.
Since the arrow $1 \rightarrow 2$ cannot be involved in a prohibited quadrangle, the induction hypothesis applies to the Catalan $(n-1)$-configuration formed by the other chords to show that the first class contains exactly $n$ good orientations.
Finally, the second class consists of a single orientation, namely, $2 \rightarrow 1$, every other arrow emerging from the smaller endpoint of the respective chord; a routine verification shows that this is indeed a good orientation. This completes the induction step and ends the proof.
Remark. Combining the arguments from Solutions 1 and 3 one gets a way (though not the easiest) to compute the Catalan number $C_{n}$.
Solution 4, sketch. (Sang-il Oum) As in the previous solution, we intend to count the number of good orientations of a Catalan $n$-configuration.
For each such configuration, we consider its dual graph $T$ whose vertices are finite regions bounded by chords and the circle, and an edge connects two regions sharing a boundary segment. This graph $T$ is a plane tree with $n$ edges and $n+1$ vertices.
There is a canonical bijection between orientations of chords and orientations of edges of $T$ in such a way that each chord crosses an edge of $T$ from the right to the left of the arrow on that edge. A good orientation of chords corresponds to an orientation of the tree containing no two edges oriented towards each other. Such an orientation is defined uniquely by its source vertex, i.e., the unique vertex having no in-arrows.
Therefore, for each tree $T$ on $n+1$ vertices, there are exactly $n+1$ ways to orient it so that the source vertex is unique - one for each choice of the source. Thus, the answer is obtained in the same way as above.
Problem 6. Fix a circle $\Gamma$, a line $\ell$ tangent to $\Gamma$, and another circle $\Omega$ disjoint from $\ell$ such that $\Gamma$ and $\Omega$ lie on opposite sides of $\ell$. The tangents to $\Gamma$ from a variable point $X$ on $\Omega$ cross $\ell$ at $Y$ and $Z$. Prove that, as $X$ traces $\Omega$, the circle $X Y Z$ is tangent to two fixed circles.
Russia, Ivan Frolov Solution. Assume $\Gamma$ of unit radius and invert with respect to $\Gamma$. No reference will be made to the original configuration, so images will be denoted by the same letters. Letting $\Gamma$ be centred at $G$, notice that inversion in $\Gamma$ maps tangents to $\Gamma$ to circles of unit diameter through $G$ (hence internally tangent to $\Gamma$ ). Under inversion, the statement reads as follows:
Fix a circle $\Gamma$ of unit radius centred at $G$, a circle $\ell$ of unit diameter through $G$, and a circle $\Omega$ inside $\ell$ disjoint from $\ell$. The circles $\eta$ and $\zeta$ of unit diameter, through $G$ and a variable point $X$ on $\Omega$, cross $\ell$ again at $Y$ and $Z$, respectively. Prove that, as $X$ traces $\Omega$, the circle $X Y Z$ is tangent to two fixed circles.

Since $\eta$ and $\zeta$ are the reflections of the circumcircle $\ell$ of the triangle $G Y Z$ in its sidelines $G Y$ and $G Z$, respectively, they pass through the orthocentre of this triangle. And since $\eta$ and $\zeta$ cross again at $X$, the latter is the orthocentre of the triangle $G Y Z$. Hence the circle $\xi$ through $X, Y, Z$ is the reflection of $\ell$ in the line $Y Z$; in particular, $\xi$ is also of unit diameter.
Let $O$ and $L$ be the centres of $\Omega$ and $\ell$, respectively, and let $R$ be the (variable) centre of $\xi$. Let $G X \operatorname{cross} \xi$ again at $X^{\prime}$; then $G$ and $X^{\prime}$ are reflections of one another in the line $Y Z$, so $G L R X^{\prime}$ is an isosceles trapezoid. Then $L R | G X$ and $\angle(L G, G X)=\angle\left(G X^{\prime}, X^{\prime} R\right)=\angle(R X, X G)$, i.e., $L G | R X$; this means that $G L R X$ is a parallelogram, so $\overrightarrow{X R}=\overrightarrow{G L}$ is constant.
Finally, consider the fixed point $N$ defined by $\overrightarrow{O N}=\overrightarrow{G L}$. Then $X R N O$ is a parallelogram, so the distance $R N=O X$ is constant. Consequently, $\xi$ is tangent to the fixed circles centred at $N$ of radii $|1 / 2-O X|$ and $1 / 2+O X$.
One last check is needed to show that the inverse images of the two obtained circles are indeed circles and not lines. This might happen if one of them contained $G$; we show that this is impossible. Indeed, since $\Omega$ lies inside $\ell$, we have $O L<1 / 2-O X$, so
this shows that $G$ is necessarily outside the obtained circles. Remarks. (1) The last check could be omitted, if we allowed in the problem statement to regard a line as a particular case of a circle. On the other hand, the Problem Selection Committee suggests not to punish students who have not performed this check. (2) Notice that the required fixed circles are also tangent to $\Omega$.