description: British mathematician John Littlewood once said about 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 a of distinct positive integers. 
  
  Define a subarray a_i, a_{i+1}, …, a_j to be a friend group if and only if there exists an integer m ≥ 2 such that a_i mod m = a_{i+1} mod m = … = a_j mod m, where x mod y denotes the remainder when x is divided by y.
  
  Your friend Gregor wants to know the size of the largest friend group in a.
  
  Input
  
  Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 2⋅ 10^4). 
  
  Each test case begins with a line containing the integer n (1 ≤ n ≤ 2 ⋅ 10^5), the size of the array a.
  
  The next line contains n positive integers a_1, a_2, …, a_n (1 ≤ a_i ≤ {10}^{18}), representing the contents of the array a. It is guaranteed that all the numbers in a are distinct.
  
  It is guaranteed that the sum of n over all test cases is less than 2⋅ 10^5.
  
  Output
  
  Your output should consist of t lines. Each line should consist of a single integer, the size of the largest friend group in a.
  
  Example
  
  Input
  
  
  4
  5
  1 5 2 4 6
  4
  8 2 5 10
  2
  1000 2000
  8
  465 55 3 54 234 12 45 78
  
  
  Output
  
  
  3
  3
  2
  6
  
  Note
  
  In the first test case, the array is [1,5,2,4,6]. The largest friend group is [2,4,6], since all those numbers are congruent to 0 modulo 2, so m=2.
  
  In the second test case, the array is [8,2,5,10]. The largest friend group is [8,2,5], since all those numbers are congruent to 2 modulo 3, so m=3.
  
  In the third case, the largest friend group is [1000,2000]. There are clearly many possible values of m that work.
solution: #include <bits/stdc++.h>
  using namespace std;
  vector<vector<int>> fourDirection = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
  vector<vector<int>> eightDirection = {{-1, 0}, {-1, 1}, {0, 1},  {1, 1},
                                        {1, 0},  {1, -1}, {0, -1}, {-1, -1}};
  long long int mod(long long int n, long long int M) { return (n % M + M) % M; }
  long long int modAdd(long long int a, long long int b, long long int M) {
    return mod(mod(a, M) + mod(b, M), M);
  }
  long long int modMul(long long int a, long long int b, long long int M) {
    return mod(mod(a, M) * mod(b, M), M);
  }
  long long int modMinus(long long int a, long long int b, long long int M) {
    return mod(mod(a, M) - mod(b, M), M);
  }
  long long int modpow(long long int x, long long int n, long long int M) {
    if (n == 0) return 1 % M;
    if (n == 1) return x % M;
    long long int u = modpow(x, n / 2, M);
    u = modMul(u, u, M);
    if (n % 2) u = modMul(u, x, M);
    return u;
  }
  long long int gcd(long long int a, long long int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
  }
  long long int extendedGcd(long long int a, long long int b, long long int &x,
                            long long int &y) {
    if (b == 0) {
      x = 1;
      y = 0;
      return a;
    }
    long long int x1, y1;
    long long int g = extendedGcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return g;
  }
  long long int modInverse(long long int a, long long int m) {
    long long int g, x, y;
    g = extendedGcd(a, m, x, y);
    if (g == 1) {
      return (x % m + m) % m;
    }
    return -1;
  }
  long long int crt(vector<long long int> &P, vector<long long int> &R) {
    int n = P.size();
    vector<long long int> X(n);
    long long int productOfAllP = 1;
    for (int i = 0; i < n; i++) productOfAllP *= P[i];
    for (int i = 0; i < n; i++) {
      X[i] = R[i];
      long long int mulOfInverse = 1;
      long long int mul = 1;
      for (int j = 0; j < i; j++) {
        mulOfInverse = modMul(mulOfInverse, modInverse(P[j], P[i]), P[i]);
        X[i] = modMinus(X[i], modMul(X[j], mul, P[i]), P[i]);
        mul = modMul(mul, P[j], P[i]);
      }
      X[i] = modMul(X[i], mulOfInverse, P[i]);
    }
    long long int finalX = 0;
    long long int mul = 1;
    for (int i = 0; i < n; i++) {
      finalX = modAdd(finalX, modMul(X[i], mul, productOfAllP), productOfAllP);
      mul = modMul(mul, P[i], productOfAllP);
    }
    return finalX;
  }
  bool isPrime(long long int n) {
    for (int i = 2; i * i <= n; i++)
      if (n % i == 0) return false;
    return true;
  }
  int getParent(vector<int> &parent, int s) {
    if (parent[s] == s) return s;
    return getParent(parent, parent[s]);
  }
  vector<int> primeNumbers;
  void sieve() {
    int limit = 1e5;
    vector<bool> prime(limit, true);
    for (long long int i = 2; i < limit; i++) {
      if (prime[i]) {
        primeNumbers.push_back(i);
        for (long long int j = i * i; j < limit; j = j + i) prime[j] = false;
      }
    }
  }
  bool insideGrid(int x, int y, int n, int m) {
    if (x >= 0 && x < n && y >= 0 && y < m) return true;
    return false;
  }
  vector<long long int> getMemAllocated(int n) {
    int ans = 1;
    while (n > ans) ans *= 2;
    ans = ans * 2 - 1;
    vector<long long int> result(ans, 0);
    return result;
  }
  long long int buildTree(vector<long long int> &tree,
                          vector<long long int> &data, int root, int start,
                          int end) {
    if (start != end) {
      int mid = (start + end) / 2;
      tree[root] = gcd(buildTree(tree, data, root * 2 + 1, start, mid),
                       buildTree(tree, data, root * 2 + 2, mid + 1, end));
    } else
      tree[root] = data[start];
    return tree[root];
  }
  long long int rangeQuery(vector<long long int> &tree, int root, int start,
                           int end, int rS, int rE) {
    if (start >= rS && end <= rE) return tree[root];
    if (start > rE || end < rS) return -1;
    int mid = (start + end) / 2;
    long long int v1 = rangeQuery(tree, root * 2 + 1, start, mid, rS, rE);
    long long int v2 = rangeQuery(tree, root * 2 + 2, mid + 1, end, rS, rE);
    if (v1 == v2) return v1;
    if (v1 == -1) return v2;
    if (v2 == -1) return v1;
    return gcd(v1, v2);
  }
  void solve() {
    int n;
    cin >> n;
    vector<long long int> data(n);
    for (int i = 0; i < n; i++) cin >> data[i];
    if (n == 1) {
      cout << 1 << "\n";
      return;
    }
    vector<long long int> dif;
    for (int i = 1; i < n; i++) dif.push_back(abs(data[i] - data[i - 1]));
    vector<long long int> T = getMemAllocated(dif.size());
    buildTree(T, dif, 0, 0, dif.size() - 1);
    int globalAns = 0;
    for (int i = 0; i < dif.size(); i++) {
      int start = i;
      int end = dif.size() - 1;
      int qAns = i;
      bool possible = false;
      while (start <= end) {
        int m = (start + end) / 2;
        long long int g = rangeQuery(T, 0, 0, dif.size() - 1, i, m);
        if (g == 1) {
          end = m - 1;
        } else {
          possible = true;
          qAns = m;
          start = m + 1;
        }
      }
      if (possible) {
        globalAns = max(globalAns, qAns - i + 1);
      }
    }
    cout << globalAns + 1 << "\n";
  }
  int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    cin >> t;
    while (t--) {
      solve();
    }
    return 0;
  }
  