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.*;
  //import java.math.*;
  
  public class Task{
  //  ..............code begins here..............
  
  static long mod=(long)1e9+7,mod1=998244353l,inf=(long)1e18+5;
  // 1111111999999, 311111111111113
  
  static void solve1() throws  IOException{
      int n=int_v(read());
      long[] a=long_arr();
      if(n<=1){out.write(1+"\n");return;}
      List<Long> l=new ArrayList<>();
      for(int i=0;i+1<n;i++){
          l.add(Math.abs(a[i]-a[i+1]));
      }
      int k=l.size();
      int[] pow=new int[20+1],log=new int[n+1];
      pow[0]=1;log[1]=0;
      for(int i=2;i<=n;i++)log[i]=log[i/2]+1;
      for(int i=1;i<=20;i++)pow[i]=pow[i-1]*2;
      long[][] dp=new long[k+1][20];
      for(int i=0;i<l.size();i++)dp[i][0]=(long)l.get(i);
      for(int i=1;i<20;i++){
          for(int j=0;j<k;j++){
              dp[j][i]=gcd(dp[Math.min(j+pow[i-1],k-1)][i-1],dp[j][i-1]);
          }
          //out.write(dp[0][i-1]+", ");
      }
      for(int i=0;i<20;i++){
          dp[k][i]=dp[k-1][i];
      }
      int l1=1,r=k,ans=0;
      while(l1<=r){
          int m=(l1+r)/2;
          boolean ok=false;
          for(int i=0;i<k&&k-i>=m;i++){
              int len=log[m];
              long tmp=gcd(dp[i][len],dp[i+m-pow[len]][len]);
              if(tmp>=2){ok=true;break;}
          }
          if(ok){
              ans=m;l1=m+1;
          }
          else r=m-1;
      }
  
      out.write((ans+1)+"\n");
  }
  //
  
  public static void main(String[] args) throws  IOException{
      assign();
      int t=int_v(read()),cn=1;
      while(t--!=0){
          //out.write("Case #"+cn+": ");
          solve1();
          //cn++;
      }
      out.flush();
  }
  
  // taking inputs
  static BufferedReader s1;
  static BufferedWriter out;
  static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
  static int int_v (String s1){return Integer.parseInt(s1);}
  static long long_v(String s1){return Long.parseLong(s1);}
  static void sort(int[] a){List<Integer> l=new ArrayList<>();for(int x:a){l.add(x);}Collections.sort(l);for(int i=0;i<a.length;i++){a[i]=l.get(i);}}
  static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
  static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
  static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
  //static String setpreciosion(double d,int k){BigDecimal d1 = new BigDecimal(Double.toString(d));return d1.setScale(k,RoundingMode.HALF_UP).toString();}//UP DOWN HALF_UP
  static int add(int a,int b){int z=a+b;if(z>=mod)z-=mod;return z;}
  static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
  static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res%m;}
  static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
  static long ModInv(long a,long m){return Modpow(a,m-2,m);}
  //static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
  //static long[] f;
  }