Olympiad Maths Prep

Track / Stage 5 / 327 of 400 #927 of 2000

Problem 927

AIME late
Number theory Difficulty 5.8 Find the answer

Given a positive integer nn. Determine the maximum value of gcd(a,b)+gcd(b,c)+gcd(c,a)\operatorname{gcd}(a, b)+\operatorname{gcd}(b, c)+\operatorname{gcd}(c, a), under the condition that a,ba, b and cc are positive integers with a+b+c=5na+b+c=5 n.

Official solution

Write G=gcd(a,b)+gcd(b,c)+gcd(c,a)G=\operatorname{gcd}(a, b)+\operatorname{gcd}(b, c)+\operatorname{gcd}(c, a). Without loss of generality, we assume that abca \leq b \leq c. Now, gcd(a,b)a,gcd(b,c)b\operatorname{gcd}(a, b) \leq a, \operatorname{gcd}(b, c) \leq b and gcd(c,a)a\operatorname{gcd}(c, a) \leq a. Therefore,

Ga+b+aa+b+c=5n G \leq a+b+a \leq a+b+c=5 n

If 3n3 \mid n, then G=5nG=5 n is achievable, namely with a=b=c=53na=b=c=\frac{5}{3} n. All three gcds are then equal to 53n\frac{5}{3} n, so G=353n=5nG=3 \cdot \frac{5}{3} n=5 n.
Now suppose further that 3n3 \nmid n. Then we know that a,ba, b and cc cannot all be equal. We distinguish several cases:

Case 1a: b=cb=c and b2nb \leq 2 n. Since now aba \neq b, we have gcd(a,b)=gcd(a,ba)ba\operatorname{gcd}(a, b)=\operatorname{gcd}(a, b-a) \leq b-a. Thus G(ba)+b+a=2b4nG \leq(b-a)+b+a=2 b \leq 4 n.

Case 1b: b=cb=c and b>2nb>2 n. We have a+2b=5na+2 b=5 n, so a=5n2ba=5 n-2 b, which implies that Ga+b+a=10n4b+b=10n3b<10n6n=4nG \leq a+b+a=10 n-4 b+b=10 n-3 b<10 n-6 n=4 n.

Case 2a: bcb \neq c and canc-a \geq n. Now, Ga+b+a=(a+b+c)(ca)=5n(ca)5nn=4nG \leq a+b+a=(a+b+c)-(c-a)=5 n-(c-a) \leq 5 n-n=4 n.

Case 2b: bcb \neq c and ca<nc-a<n. Since abca \leq b \leq c, we also have cb<nc-b<n. Furthermore, bcb \neq c and thus aca \neq c. So gcd(c,a)=gcd(ca,a)ca<n\operatorname{gcd}(c, a)=\operatorname{gcd}(c-a, a) \leq c-a<n and gcd(b,c)=gcd(b,cb)cb<n\operatorname{gcd}(b, c)=\operatorname{gcd}(b, c-b) \leq c-b<n. In addition, a5n3a \leq \frac{5 n}{3}. We conclude that G<5n3+n+n<4nG<\frac{5 n}{3}+n+n<4 n.

We see that in all cases G4nG \leq 4 n. The value G=4nG=4 n is achievable with a=n,b=2na=n, b=2 n and c=2nc=2 n, because then gcd(a,b)=gcd(c,a)=n\operatorname{gcd}(a, b)=\operatorname{gcd}(c, a)=n and gcd(b,c)=2n\operatorname{gcd}(b, c)=2 n.
Thus, the maximum value of GG is 5n5 n if 3n3 \mid n and 4n4 n if 3n3 \nmid n.

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