Write G=gcd(a,b)+gcd(b,c)+gcd(c,a). Without loss of generality, we assume that a≤b≤c. Now, gcd(a,b)≤a,gcd(b,c)≤b and gcd(c,a)≤a. Therefore,
G≤a+b+a≤a+b+c=5n
If 3∣n, then G=5n is achievable, namely with a=b=c=35n. All three gcds are then equal to 35n, so G=3⋅35n=5n.
Now suppose further that 3∤n. Then we know that a,b and c cannot all be equal. We distinguish several cases:
Case 1a: b=c and b≤2n. Since now a=b, we have gcd(a,b)=gcd(a,b−a)≤b−a. Thus G≤(b−a)+b+a=2b≤4n.
Case 1b: b=c and b>2n. We have a+2b=5n, so a=5n−2b, which implies that G≤a+b+a=10n−4b+b=10n−3b<10n−6n=4n.
Case 2a: b=c and c−a≥n. Now, G≤a+b+a=(a+b+c)−(c−a)=5n−(c−a)≤5n−n=4n.
Case 2b: b=c and c−a<n. Since a≤b≤c, we also have c−b<n. Furthermore, b=c and thus a=c. So gcd(c,a)=gcd(c−a,a)≤c−a<n and gcd(b,c)=gcd(b,c−b)≤c−b<n. In addition, a≤35n. We conclude that G<35n+n+n<4n.
We see that in all cases G≤4n. The value G=4n is achievable with a=n,b=2n and c=2n, because then gcd(a,b)=gcd(c,a)=n and gcd(b,c)=2n.
Thus, the maximum value of G is 5n if 3∣n and 4n if 3∤n.