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.math.BigInteger;
  import java.util.*;
  import static java.lang.Math.*;
  
  public class SolutionD {
      private static FastScanner in = new FastScanner();
      private static PrintWriter out =
          new PrintWriter(new BufferedOutputStream(System.out));
  
      public static void main(String[] args) {
          
          tests();
          // solve();
          
          out.close();
      }
  
      
      static void solve() {
          int n = in.nextInt();
  
          long[] a = new long[n];
          for (int i = 0; i < n; i++) {
              a[i] = in.nextLong();
          }
  
          n--;
          long[] d = new long[n];
          for (int i = 0; i < n; i++) {
              d[i] = abs(a[i] - a[i + 1]);
          }
  
          SegmentTree st = new SegmentTree(d);
          
          int answer = 1;
          int l = 0, r = 1;
          while (l < r && r <= n) {
              if (d[l] == 1) {
                  l++;
                  if (l == r) r++;
                  continue;
              }
              if (st.query(l, r) > 1) {
                  answer = max(answer, r - l + 1);
                  r++;
              }
              else {
                  l++;
              }
          }
  
          out.println(answer);
      }
  
      static long gcd(long x, long y) {
          if (y == 0) return x;
          return gcd(y, x % y);
      }
  
      static void tests() {
          int t = in.nextInt();
          while (t-- > 0) {
              solve();
          }
      }
  
      static class SegmentTree {
      
          private int size;
          private Node[] tree;
      
          SegmentTree(long[] a) {
              size = 1;
              while (size < a.length) size *= 2;
              tree = new Node[2*size];
              build(a);
          }
      
          private static class Node {
              long gcd;
  
              Node() { gcd = 0; } // neutral 
              Node(long gcd) { this.gcd = gcd; }
          }
  
          static Node merge(Node v, Node w) {
              if (v == null) return w;
              if (w == null) return v;
  
              long gcd = gcd(v.gcd, w.gcd);
              return new Node(gcd);
          }
  
          public long query(int from, int to) {
              return query(from, to, 0, 0, size).gcd;
          }
  
          public void build(long[] a) {
              build(a, 0, 0, size);
          }
      
          public void set(int index, long value) {
              set(index, value, 0, 0, size);
          }
      
          private void build(long[] a, int node, int lo, int hi) {
              if (hi - lo == 1) {
                  if (lo < a.length) {
                      tree[node] = new Node(a[lo]);
                  }
                  return;
              }
      
              int mid = (lo + hi) / 2;
              build(a, 2*node + 1, lo, mid);
              build(a, 2*node + 2, mid, hi);
              
              tree[node] = merge(tree[2*node + 1], tree[2*node + 2]);
          }
          
          private void set(int index, long value, int node, int lo, int hi) {
              if (hi - lo == 1) { // leaf node
                  tree[node] = new Node(value);
                  return;
              }
      
              int mid = (lo + hi) / 2;
              
              if (index < mid) { // go left
                  set(index, value, 2*node + 1, lo, mid);
              }
              else { // go right
                  set(index, value, 2*node + 2, mid, hi);
              }
      
              tree[node] = merge(tree[2*node + 1], tree[2*node + 2]);
          }
      
          private Node query(int from, int to, int node, int lo, int hi) {
              if (to <= lo || hi <= from) { // don't intersect
                  return new Node();
              }
              if (from <= lo && hi <= to) { // fully contains
                  return tree[node];
              }
      
              int mid = (lo + hi) / 2;
      
              Node leftResult = query(from, to, 2*node + 1, lo, mid); 
              Node rightResult = query(from, to, 2*node + 2, mid, hi); 
              return merge(leftResult, rightResult);
          }
      }
  
      private static class FastScanner {
          private BufferedReader br;
          private StringTokenizer st;
      
          public FastScanner() {
              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;
          }
      }
  }
  