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.util.*;
  import java.io.*;
  public class Sol{
  
  /*   
  ->n=1 important test case
  ->Dont get stuck on one approach try all possibilities
  ->check int overflow,array bounds,etc
  ->Dont think just idea think of its (correct) implementation completely (then only code)
  */
  
  public static void main(String []args){
  //precomp();
  int times=ni();while(times-->0){solve();}out.close();}
  
  static void solve(){  
       int n=ni();int ans=1;
       long A[]=new long[n];
       for(int i=0;i<n;i++)A[i]=nl();
       if(n==1){out.println(1);return;}
       n--;
       long a[]=new long[n];
       for(int i=0;i<n;i++){a[i]=A[i+1]-A[i];if(a[i]<0){a[i]*=-1;}}
       
       
      
       long m[][]=new long[n][20];
       for(int i=0;i<n;i++){m[i][0]=a[i];}
       
       for(int j=1;j<20;j++){
          for(int i=0;i+(1<<j)-1<n;i++){
           m[i][j]=gcd(m[i][j-1],m[i+(1<<j-1)][j-1]);
          
          }
       }
       int l=0;int r=n+1;
       while(l+1<r){
          int mid=(l+r)/2;
          if(good(mid,m,n))l=mid;
          else r=mid;
      } 
   
        out.println(l+1);
        return;
   }
  
  //-----------------Utility--------------------------------------------
  
  //error 3 4
  static boolean good(int len,long m[][],int n){
        int j=log2(len); 
     for(int i=0;i+len-1<n;i++){
        long g1=m[i][j];
        int k=i+len-(1<<j);
        if(k>=n)break;
        long g2=m[k][j];
      
        if(gcd(g1,g2)>1)return true;
     }
     return false;       
   }
   
  static int log2(int n){int j=-1;while(n>0){j++;n/=2;}return j;}
  
  static long gcd(long a,long b){if(b==0)return a; return gcd(b,a%b);}
   
  static int Max=Integer.MAX_VALUE; static long mod=1000000007;
   
  static int v(char c){return (int)(c-'a');}
  
  public static long power(long x, long y )
      {
          //0^0 = 1
          long res = 1L;
          x = x%mod;
          while(y > 0)
          {
              if((y&1)==1)
                  res = (res*x)%mod;
              y >>= 1;
              x = (x*x)%mod;
          }
          return res;
      }
   
  static class Pair implements Comparable<Pair>{
          int id;int value;Pair next;
          public Pair(int id,int value) {
           
            this.id=id;this.value=value;next=null;
          }
          @Override
          public int compareTo(Pair p){return Long.compare(value,p.value);}
      }
  
  //----------------------I/O---------------------------------------------
   
  static InputStream inputStream = System.in;
  static OutputStream outputStream = System.out;
  static FastReader in=new FastReader(inputStream);
  static PrintWriter out=new PrintWriter(outputStream);
   
  static class FastReader 
  { 
    BufferedReader br; 
    StringTokenizer st; 
   
          FastReader(InputStream is) {
              br = new BufferedReader(new InputStreamReader(is));
          }
   
    public String next() 
    { 
        while (st == null || !st.hasMoreElements()) 
        { 
            try
            { 
                st = new StringTokenizer(br.readLine()); 
            } 
            catch (IOException  e) 
            { 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
   
    public int nextInt() 
    { 
        return Integer.parseInt(next()); 
    } 
   
    public long nextLong() 
    { 
        return Long.parseLong(next()); 
    } 
   
   public  double nextDouble() 
    { 
        return Double.parseDouble(next()); 
    } 
   
   
    String nextLine() 
    { 
        String str = ""; 
        try
        { 
            str = br.readLine(); 
        } 
        catch (IOException e) 
        { 
            e.printStackTrace(); 
        } 
        return str; 
    } 
  }
  static int ni() {
          return in.nextInt();
      }
  static long nl(){return in.nextLong();}
  static String ns(){return in.nextLine();}
  //---------------------I/O------------------------------------------------- 
  }