#P7976. Integers Have Friends 2.0
Integers Have Friends 2.0
Integers Have Friends 2.0
Problem Description
Acknowledgment: Special thanks to Codeforces Problem 1548B Integer Have Friends for providing the general statement for this problem. Indian mathematician Srinivasa Ramanujan once quoted the famous words of Indian mathematician Srinivasa Ramanujan(?) that "every positive integer was one of his personal friends." It turns out that positive integers can also be friends with each other! You are given an array of distinct positive integers. Define a subsequence where and to be a friend group if and only if there exists an integer such that , where denotes the remainder when is divided by . Your friend gispzjz wants to know the size of the largest friend group in . Can you help him?
Input
The first line contains a number , denoting the number of test cases. The first line of each test case contains one integer , denoting the size of the array . Then one line containing integers follow, representing the contents of the array . It is guaranteed that all the numbers in are distinct.
It is guaranteed that over all test cases.
Output
For each test case, output a line consisting of a single integer, denoting the size of the largest friend group in .
Sample Input
3
3
10 12 15
4
4 6 9 19
6
2 8 11 15 19 38
Sample Output
2
3
4
Source
2021“MINIEYE杯”中国大学生算法设计超级联赛(9)