#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
long long t, n;
long long a[400010];
long long c[400010][20];
long long lg[400010];
inline long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long ask(long long a, long long b) {
  long long lo = lg[b - a + 1];
  long long po = 1 << lo;
  return gcd(c[a][lo], c[b - po + 1][lo]);
}
bool check(long long len) {
  for (register long long i = 1; i <= n - 1; ++i) {
    long long x = i, y = (i + len) - 1;
    if (y >= n) break;
    if (ask(x, y) > 1) return 1;
  }
  return 0;
}
int main() {
  lg[0] = -1;
  for (register long long i = 1; i <= 400000; ++i) lg[i] = lg[i >> 1] + 1;
  t = rd();
  while (t--) {
    long long res = 0;
    n = rd();
    for (register long long i = 1; i <= n; ++i) a[i] = rd();
    for (register long long i = 1; i <= n - 1; ++i)
      c[i][0] = abs(a[i + 1] - a[i]);
    for (long long i = 1; i <= lg[n]; i++)
      for (long long j = 1; j + (1 << i) - 1 <= n; j++) {
        long long po = 1 << (i - 1);
        c[j][i] = gcd(c[j][i - 1], c[j + po][i - 1]);
      }
    long long l = 1, r = n;
    while (l < r) {
      long long mid = (l + r) / 2;
      if (check(mid))
        l = mid + 1, res = mid;
      else
        r = mid;
    }
    printf("%lld\n", res + 1);
  }
  return 0;
}
