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.util.ArrayList;
  import java.util.Arrays;
  import java.util.StringTokenizer;
  import java.util.List;
   import java.util.*;
   public class realfast implements Runnable 
    {
      private static final int INF = (int) 1e9;
      long in= 1000000007;
      long fac[]= new long[1000001];
      long inv[]=new long[1000001];
      public  void solve() throws IOException 
      {
          
       
            
  
         //   out.println(cnt);
  
          int t = readInt();
  
          for(int f =0;f<t;f++)
          {
               int n = readInt();
               long arr[]=new long[n+1];
               for(int i=1;i<=n;i++)
                  arr[i]= readLong();
              if(n==1)
                  out.println(1);
               else
               {
                int max=1;
                for(int i=1;i<n;i++)
                {
                  arr[i]= Math.abs(arr[i]-arr[i+1]);
                }
                long seg[]=new long[4*n+4];
                build(seg,arr,1,n-1,0);
                int start=1;
                for(int i=1;i<=n-1;i++)
                {
                  if(arr[i]==1)
                      continue;
                  start= Math.max(i,start);
                  long kl = gc(seg,1,n-1,0,i,start);
                  
                  while(start<n&&kl>1)
                  {
                     kl = gcd(kl,arr[start]);
                     if(kl!=1)
                     start++;
                  }
                
                  max=Math.max(max,start-i+1);
                }
                
                out.println(max);
              }
  
          }
            
        
  
      }
  
      public long gc(long seg[], int left , int right ,int index , int l , int r)
      {
          if(left>r||l>right)
              return 0;
  
          if(left>=l&&right<=r)
              return seg[index];
  
          int mid = left+(right-left)/2;
  
          long val = gc(seg,left,mid,2*index+1,l,r);
          long val1 = gc(seg,mid+1,right,2*index+2,l,r);
  
          return gcd(val,val1);
  
      }
  
      public void build(long seg[] , long arr[] , int left , int right,int index)
      {
          if(left==right)
          {
              seg[index]= arr[left];
              return;
          }
  
          int mid = left+(right-left)/2;
  
          build(seg,arr,left,mid,2*index+1);
          build(seg,arr,mid+1,right,2*index+2);
  
          seg[index]= gcd(seg[2*index+1],seg[2*index+2]);
          
      }
     
     
      public long gcd(long a , long b )
      {
  
        if(a<b)
        {
          long t =a;
          a=b;
          b=t;
        }
        if(b==0)
          return a;
        if(a%b==0)
          return b ;
        return gcd(b,a%b);
      }
      public long pow(long n , long p,long m)
      {
           if(p==0)
              return 1;
          long val = pow(n,p/2,m);;
          val= (val*val)%m;
          if(p%2==0)
              return val;
          else
              return (val*n)%m;
      }
      
      
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      public static void main(String[] args) {
          new Thread(null, new realfast(), "", 128 * (1L << 20)).start();
      }
   
      private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
      private BufferedReader reader;
      private StringTokenizer tokenizer;
      private PrintWriter out;
   
      @Override
      public void run() {
          try {
              if (ONLINE_JUDGE || !new File("input.txt").exists()) {
                  reader = new BufferedReader(new InputStreamReader(System.in));
                  out = new PrintWriter(System.out);
              } else {
                  reader = new BufferedReader(new FileReader("input.txt"));
                  out = new PrintWriter("output.txt");
              }
              solve();
          } catch (IOException e) {
              throw new RuntimeException(e);
          } finally {
              try {
                  reader.close();
              } catch (IOException e) {
                  // nothing
              }
              out.close();
          }
      }
   
      private String readString() throws IOException {
          while (tokenizer == null || !tokenizer.hasMoreTokens()) {
              tokenizer = new StringTokenizer(reader.readLine());
          }
          return tokenizer.nextToken();
      }
   
      @SuppressWarnings("unused")
      private int readInt() throws IOException {
          return Integer.parseInt(readString());
      }
   
      @SuppressWarnings("unused")
      private long readLong() throws IOException {
          return Long.parseLong(readString());
      }
   
      @SuppressWarnings("unused")
      private double readDouble() throws IOException {
          return Double.parseDouble(readString());
      }
  }
  class edge implements Comparable<edge>{
      int u ;
      int v;
      
      edge(int  u, int v)
      {
         this.u=u;
         this.v=v;
      }
      public int compareTo(edge e)
      {
          return this.v-e.v;
      }
  }