I cant get this question…
Someone help me plzzz…
Thanks in advance!!
The Little Elephant from the Zoo of Lviv has an array A that consists of N positive integers. Let A[i] be the i-th number in this array (i = 1, 2, …, N).
Find the minimal number x > 1 such that x is a divisor of all integers from array A. More formally, this x should satisfy the following relations:
A mod x = 0, A mod x = 0, …, A[N] mod x = 0,
where mod stands for the modulo operation. For example, 8 mod 3 = 2, 2 mod 2 = 0, 100 mod 5 = 0 and so on. If such number does not exist, output -1.
The first line of the input contains a single integer T, the number of test cases. T test cases follow. The first line of each test case contains a single integer N, the size of the array A for the corresponding test case. The second line contains N space separated integers A, A, …, A[N].
For each test case output a single line containing the answer for the corresponding test case.
1 ≤ T ≤ 100000
1 ≤ N ≤ 100000
The sum of values of N in each test file does not exceed 100000
1 ≤ A[i] ≤ 100000
2 4 8
4 7 5