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 sys
  import math
  #import random
  input=sys.stdin
  output=sys.stdout
  
  t=int(input.readline().strip())
  for i in range(t):
      n=int(input.readline().strip())
      a=[int(x) for x in input.readline().strip().split()]
  #    n=random.randrange(1,100)
  #    a=[random.randrange(1,100000000) for x in range(n)]
  
      bmax=0
      b=[0]*(n-1)
      for j in range(n-1):
          b[j]=a[j]-a[j+1]
          if b[j]<0:
              b[j]=-b[j]
          if b[j]!=1:
              bmax=1    
  
      if bmax==0:
          print(1)
          continue        
  
  #    def HCF(a, b):
  #        if a==0:
  #            return b
  #        elif b==0:
  #            return a
  #        elif a>b:
  #            return HCF(a%b, b)
  #        else:
  #            return HCF(b%a, a)
  
  #    def HCF(x, y):
  #        while True:
  #            if x==0:
  #                return y
  #            elif y==0:
  #                return x
  #            elif x>y:
  #                x=x%y
  #            else:
  #                y=y%x
  
      def HCF(x, y):
          while x>1:
              x, y=y%x, x
          if x==1:
              return 1
          else:        
              return y
          
      St=[[b[x]] for x in range(n-1)]
      upton=1
      while upton<n:
          for j in range(n-upton*2):
              a=HCF(St[j][-1], St[j+upton][-1])
              St[j].append(a)
              if a!=1:
                  bmax=upton*2
          upton*=2                                    
  
   #   total=bmax
   #   c=int(0.5+math.log2(bmax))
   #   k=0
   #   while k+total<n:
   #       if St[k][c]!=1:
   #           start=total+1
   #           end=min(n-k-1, bmax*2-1)
   #           while start<=end:
   #               j=(start+end)//2
   #               if HCF(St[k][c], St[k+j-2**c][c])!=1:
   #                   total=j
   #                   start=j+1
   #               else:
   #                   end=j-1    
   #       k+=1
  
      def possible_group(x, y):
          c=b[x]
          for i in range(x+1, y):
              c=HCF(c, b[i])
              if c==1:
                  return False
          return True        
  
      total=bmax
      start=bmax+1
      end=min(n-1, bmax*2-1)
      c=int(0.5+math.log2(bmax))
      while start<=end:
          j=(start+end)//2
          for k in range(n-j):            
              if HCF(St[k][c], St[k+j-2**c][c])!=1:
                  total=j
                  start=j+1
                  break
          if start<=j:
              end=j-1
              
      
      print(total+1)
  
  #    test=0
  #    for j in range(1,n):
  #        for k in range(n-j):
  #            if possible_group(k,k+j):
  #                test=j
  #                break
  #        if test<j:
  #            break    
  
  #    if test!=total:
  #        print(test,total)        
  
      
  
      