GCDS - Sabbir and gcd problem
题意翻译
- 给定 $n$ 个整数 $a_i$,找到最小的整数 $x$ 使得他与所有的 $a_i$ 都互质且 $x>1$。
- **多组数据**,$1 \le t \le 10$。
- 对于 $100\%$ 的数据,$1 \le n \le 10^5$,$1 \le a_i \le 10^7$。
- Translated by 一只书虫仔。
题目描述
Sabbir is a little boy. He loves math very much. one day his friend taskin gave him a very hard task. taskin gave him _**n**_ numbers _**a $ _{1} $ ,a $ _{2} $ ,a $ _{3} $ ,......a $ _{n} $**_
taskin asked for a minimum integer number _**x**_ (**x > 1**) such that _**gcd(x,a $ _{1} $ ) = 1, gcd(x,a $ _{2} $ ) = 1, ...... gcd(x,a $ _{n} $ ) = 1**_,
in other words you have to find a minimum integer _**_x_ ( x > 1 )**_ such that
[**![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP30919/9a61eb88995ea804d556f658307451f21ac90d9b.png)&space;=&space;1 "\forall i ,\ i\epsilon [1....n] ,\ gcd(x,a_{i}) = 1")**](https://www.codecogs.com/eqnedit.php?latex=\forall&space;i&space;,\&space;i\epsilon&space;[1....n]&space;,\&space;gcd(x,a_{i})&space;=&space;1)
**Note:** **gcd is greatest common divisor**
输入输出格式
输入格式
In the first line there will be an integer **T ,** denoting the number of test cases,
each test case is consists of 2 lines..
in the first line there will be **n ,** denoting the number of integers and next line contains **n** space separated integers **$a _ 1, a _ 2, \cdots, a _ n$**
[![](https://latex.codecogs.com/gif.latex?1&space;\leq&space;T&space;\leq&space;10 "1 \leq T \leq 10")](https://www.codecogs.com/eqnedit.php?latex=1&space;\leq&space;T&space;\leq&space;10)
[![](https://latex.codecogs.com/gif.latex?1&space;\leq&space;n&space;\leq&space;10^{5} "1 \leq n \leq 10^{5}")](https://www.codecogs.com/eqnedit.php?latex=1&space;\leq&space;n&space;\leq&space;10^{5})
[](https://www.codecogs.com/eqnedit.php?latex=1&space;\leq&space;n&space;\leq&space;10^{5}) [![](https://latex.codecogs.com/gif.latex?1&space;\leq&space;a_{i}&space;\leq&space;10^{7} "1 \leq a_{i} \leq 10^{7}")](https://www.codecogs.com/eqnedit.php?latex=1&space;\leq&space;a_{i}&space;\leq&space;10^{7})
输出格式
for every case print one integer **x** in one line .
Note: **x** should be greater than 1.
输入输出样例
输入样例 #1
3
3
5 7 25
4
1 2 3 4
1
2
输出样例 #1
2
5
3