Maximum GCD Pair
Submissions: 917   Accuracy:

22.27%

  Difficulty: Medium   Marks: 4

Given an array of integers find the pair in the array with maximum GCD.

Input:

The first line of the input contains an integer T denoting number of Tetscase. The first line oof each Test case contains an integer N, denoting size of the array. The next line contains N space separated integers.
Output:

Print the Maximum Gcd.


Constraints:

1<=T<=3

1<=N<=10^5

1<=A[i]<=10^5


Example:

Input

1

5

1 2 3 4 5

Output

2

 

The pair (2,4) has the maximum gcd i.e. 2.

 

** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.