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: import java.io.*;
  import java.lang.reflect.Array;
  import java.math.BigInteger;
  import java.util.*;
  import java.util.BitSet;
  import java.util.function.BinaryOperator;
  
  public class D {
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new
                      InputStreamReader(System.in));
          }
  
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
  
      static FastReader s = new FastReader();
      static PrintWriter out = new PrintWriter(System.out);
  
      private static int[] rai(int n) {
          int[] arr = new int[n];
          for (int i = 0; i < n; i++) {
              arr[i] = s.nextInt();
          }
          return arr;
      }
  
      private static int[][] rai(int n, int m) {
          int[][] arr = new int[n][m];
          for (int i = 0; i < n; i++) {
              for (int j = 0; j < m; j++) {
                  arr[i][j] = s.nextInt();
              }
          }
          return arr;
      }
  
      private static long[] ral(int n) {
          long[] arr = new long[n];
          for (int i = 0; i < n; i++) {
              arr[i] = s.nextLong();
          }
          return arr;
      }
  
      private static long[][] ral(int n, int m) {
          long[][] arr = new long[n][m];
          for (int i = 0; i < n; i++) {
              for (int j = 0; j < m; j++) {
                  arr[i][j] = s.nextLong();
              }
          }
          return arr;
      }
  
      private static int ri() {
          return s.nextInt();
      }
  
      private static long rl() {
          return s.nextLong();
      }
  
      private static String rs() {
          return s.next();
      }
  
  
      static long gcd(long a,long b)
      {
          if(b==0)
          {
              return a;
          }
          return gcd(b,a%b);
      }
  
      static int MOD=(int)1e9+7;
  
      public static int primeFactors(long n)
      {
          // Print the number of 2s that divide n
          int count=0;
          while (n % 2 == 0) {
              count++;
              n /= 2;
          }
  
          // n must be odd at this point.  So we can
          // skip one element (Note i = i +2)
          for (long i = 3; i * i<=n; i += 2) {
              // While i divides n, print i and divide n
              while (n % i == 0) {
                  count++;
                  n /= i;
              }
          }
  
          // This condition is to handle the case whien
          // n is a prime number greater than 2
          if (n > 2)
              count++;
  
          return count;
      }
      static int factors(int n)
      {
          HashSet<Integer> set=new HashSet<>();
          for(int i=1;i*i<=n;i++)
          {
              if(n%i==0)
              {
                  set.add(i);
                  set.add(n/i);
              }
          }
          return set.size()-1;
      }
  
      static List<Integer> primes = new ArrayList<>();
      static int countPF(int x) {
          int count=0;
          for (int i:primes) {
              while (x%i==0) {
                  count++;
                  x/=i;
              }
          }
          if (x>1) count++;
          return count;
      }
  
      static List<Integer> sieveOfEratosthenes(int n)
      {
  
          boolean[] prime = new boolean[n + 1];
          for (int i = 0; i <= n; i++)
              prime[i] = true;
  
          for (int p = 2; p * p <= n; p++)
          {
              // If prime[p] is not changed, then it is a
              // prime
              if (prime[p])
              {
                  // Update all multiples of p
                  for (int i = p * p; i <= n; i += p)
                      prime[i] = false;
              }
          }
  
          List<Integer> list = new ArrayList<>();
          for(int i=2;i<=n;i++)
          {
              if(prime[i])
              {
                  list.add(i);
              }
  
          }
  
          return list;
      }
  
      static int bsearch(SparseMatrix sp, int i ,int len)
      {
          int l=i,r=len-1;
          int ind = -1;
          while(l<=r)
          {
              int mid = (l+r)/2;
              long gcd = sp.getGCD(i,mid);
              if(gcd>1)
              {
                  ind=mid;
                  l=mid+1;
              }
              else
              {
                  r=mid-1;
              }
          }
          return ind;
      }
      public static void main(String[] args) {
          StringBuilder ans = new StringBuilder();
  
          int t = ri();
  //        int t=1;
          while(t-- >0)
          {
              int n=ri();
              long[] arr=ral(n);
              if(n==1)
              {
                  ans.append("1\n");
                  continue;
              }
  
              long[] diff = new long[n-1];
              int len = n-1;
              for(int i=0;i<len;i++)
              {
                  diff[i] = Math.abs(arr[i+1]-arr[i]);
              }
  
              SparseMatrix sp = new SparseMatrix(diff);
  //            System.out.println(Arrays.toString(diff));
              int max = 0;
              for(int i=0;i<len;i++)
              {
                  int ind = bsearch(sp,i,len);
  //                System.out.println(i+" "+ind);
                  max=Math.max(ind-i+1,max);
              }
              ans.append(max+1).append("\n");
  
  
          }
          out.print(ans.toString());
          out.flush();
      }
      public static class SparseMatrix {
          private long[] arr;
          private int m;
          private long[][] minSparse;
  
  
          private int n;
          public SparseMatrix(long[] arr) {
              this.arr = arr;
              this.m=arr.length;
              this.n=Integer.toBinaryString(m).length();
              minSparse=new long[n][m];
  
              createMinSparse();
          }
          private long gcd(long a,long b)
          {
              if(b==0)
              {
                  return a;
              }
              return gcd(b,a%b);
          }
          private void createMinSparse()
          {
              //filling the first row of sparse matrix with the values of the input array
              for(int j=0;j<m;j++)
              {
                  minSparse[0][j]=arr[j];
              }
              //filling other rows of the sparse matrix
              for(int i=1;i<n;i++)
              {
                  for(int j=0;j+(1<<(i-1))<m;j++)
                  {
  
                      long left=minSparse[i-1][j];
                      long right=minSparse[i-1][j+(1<<(i-1))];
  
                      //change to min-> max to create MaxSparseMatrix
                      minSparse[i][j]=gcd(left,right);
  
  
                  }
              }
          }
  
          //get minimum value in range l->r inclusive
      /*
          for any range [l, r] we can find the two values and
          find their minimum. These values are defined below:
  
          len: length of the required range, i.e., r-l+1
  
          p: maximum power of 2 that can fit in len. E.g, [1,11] , len=11, thus p=3
  
          k: 2^p
  
          find the minimum between sparse[p][l] and sparse[p][r-k+1]
      */
          public long getGCD(int l,int r)
          {
              int len=r-l+1;
              int p=Integer.toBinaryString(len).length()-1;
              int k=1<<p;
  
              long left=minSparse[p][l];
              long right=minSparse[p][r-k+1];
              return gcd(right,left);
          }
  
  
  
      }
  
  }