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.OutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.io.PrintWriter;
  import java.util.Arrays;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.StringTokenizer;
  import java.io.Writer;
  import java.io.OutputStreamWriter;
  import java.io.BufferedReader;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   */
  public class Main {
      public static void main(String[] args) {
          InputStream inputStream = System.in;
          OutputStream outputStream = System.out;
          InputReader in = new InputReader(inputStream);
          OutputWriter out = new OutputWriter(outputStream);
          DIntegersHaveFriends solver = new DIntegersHaveFriends();
          int testCount = Integer.parseInt(in.next());
          for (int i = 1; i <= testCount; i++)
              solver.solve(i, in, out);
          out.close();
      }
  
      static class DIntegersHaveFriends {
          public void solve(int testNumber, InputReader in, OutputWriter out) {
              int n = in.nextInt();
              long[] arr = in.nextLongArray(n);
              long[] diff = new long[n - 1];
              for (int i = 0; i < n - 1; i++) {
                  diff[i] = Math.abs(arr[i] - arr[i + 1]);
              }
  
              DIntegersHaveFriends.CompactSegmentTree st = new DIntegersHaveFriends.CompactSegmentTree(diff);
              n--;
              long ans = 0;
              int head = -1;
              int tail = 0;
  
              while (tail < n) {
                  // condition
                  if (head == n - 1) break;
                  while (head + 1 < n && (st.query(tail, head + 2) > 1)) {
                      head++;
                  }
                  ans = Math.max(ans, head - tail + 1);
                  if (head == n - 1) break;
                  if (head < tail) {
                      tail++;
                      head = tail - 1;
                  } else {
                      while (tail <= head && st.query(tail, head + 2) == 1) {
                          tail++;
                      }
                  }
              }
  
              out.println(ans + 1);
          }
  
          public static class CompactSegmentTree {
              private int N;
              private long UNIQUE = 8123572096793136074L;
              private long[] tree;
  
              public CompactSegmentTree(int size) {
                  tree = new long[2 * (N = size)];
                  Arrays.fill(tree, UNIQUE);
              }
  
              public CompactSegmentTree(long[] values) {
                  this(values.length);
                  // TODO(william): Implement smarter construction.
                  for (int i = 0; i < N; i++) modify(i, values[i]);
              }
  
              private long function(long a, long b) {
                  if (a == UNIQUE) return b;
                  else if (b == UNIQUE) return a;
  
                  return gcd(a, b); // sum over a range
                  // return (a > b) ? a : b; // maximum value over a range
                  // return (a < b) ? a : b; // minimum value over a range
                  // return a * b; // product over a range (watch out for overflow!)
              }
  
              public long gcd(long a, long b) {
                  return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b);
              }
  
              public void modify(int i, long value) {
                  tree[i + N] = function(tree[i + N], value);
                  for (i += N; i > 1; i >>= 1) {
                      tree[i >> 1] = function(tree[i], tree[i ^ 1]);
                  }
              }
  
              public long query(int l, int r) {
                  long res = UNIQUE;
                  for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
                      if ((l & 1) != 0) res = function(res, tree[l++]);
                      if ((r & 1) != 0) res = function(res, tree[--r]);
                  }
                  if (res == UNIQUE) {
                      throw new IllegalStateException("UNIQUE should not be the return value.");
                  }
                  return res;
              }
  
          }
  
      }
  
      static class OutputWriter {
          private final PrintWriter writer;
  
          public OutputWriter(OutputStream outputStream) {
              writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
          }
  
          public OutputWriter(Writer writer) {
              this.writer = new PrintWriter(writer);
          }
  
          public void close() {
              writer.close();
          }
  
          public void println(long i) {
              writer.println(i);
          }
  
      }
  
      static class InputReader {
          BufferedReader reader;
          StringTokenizer tokenizer;
  
          public InputReader(InputStream stream) {
              reader = new BufferedReader(new InputStreamReader(stream), 32768);
              tokenizer = null;
          }
  
          public String next() {
              while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                  try {
                      tokenizer = new StringTokenizer(reader.readLine());
                  } catch (IOException e) {
                      throw new RuntimeException(e);
                  }
              }
              return tokenizer.nextToken();
          }
  
          public long[] nextLongArray(int n) {
              long[] array = new long[n];
              for (int i = 0; i < n; ++i) array[i] = nextLong();
              return array;
          }
  
          public int nextInt() {
              return Integer.parseInt(next());
          }
  
          public long nextLong() {
              return Long.parseLong(next());
          }
  
      }
  }
  
  