Can anyone please help me out with the https://www.codechef.com/JUNE19B/problems/SUMAGCD question?
Chef has a sequence of positive integers $A_1,A_2, \dots, A_N$. He wants to split this sequence into two non-empty (not necessarily contiguous) subsequences $B$ and $C$ such that $\text{GCD}(B) + \text{GCD}(C)$ is maximum possible. Help him find this maximum value.
Example case 1: For example, the sequence $A=(4,4,7,6)$ can be divided into subsequences $B=(4,4,6)$ and $C=(7)$.
But how the output comes out to be 9 As gcd of 7 is 1 itself.