#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int A, long long int B) {
  if (B == 0)
    return A;
  else
    return gcd(B, A % B);
}
void build(vector<long long int>& a, int v, int tl, int tr,
           vector<long long int>& t) {
  if (tl == tr) {
    t[v] = a[tl];
  } else {
    int tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm, t);
    build(a, v * 2 + 1, tm + 1, tr, t);
    t[v] = gcd(t[v * 2], t[v * 2 + 1]);
  }
}
long long int g(int v, int tl, int tr, int l, int r, vector<long long int>& t) {
  if (l > r) return 0;
  if (l == tl && r == tr) {
    return t[v];
  }
  int tm = (tl + tr) / 2;
  return gcd(g(v * 2, tl, tm, l, min(r, tm), t),
             g(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, t));
}
bool check(int n, long long int mid, vector<long long int>& t) {
  for (int i = 0; i <= n - mid; i++) {
    if (g(1, 0, n - 1, i, i + mid - 1, t) != 1) {
      return true;
    }
  }
  return false;
}
void solve() {
  int n;
  cin >> n;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  ;
  vector<long long int> t(4 * n);
  vector<long long int> a(n - 1);
  if (n == 1) {
    cout << "1\n";
    return;
  }
  for (int i = 0; i < n - 1; i++) {
    a[i] = abs(v[i] - v[i + 1]);
  }
  build(a, 1, 0, n - 2, t);
  int l = -1;
  int r = n;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (check(n - 1, mid, t)) {
      l = mid;
    } else {
      r = mid;
    }
  }
  cout << l + 1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
