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.io.BufferedWriter;
  import java.io.Writer;
  import java.io.OutputStreamWriter;
  import java.util.InputMismatchException;
  import java.io.IOException;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   *
   * @author Akshay Mishra
   */
  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();
          solver.solve(1, in, out);
          out.close();
      }
  
      static class DIntegersHaveFriends {
          public static long seg[];
          public static long arr[];
  
          public static long gcd(long a, long b) {
              if (a == 0)
                  return b;
              return gcd(b % a, a);
          }
  
          public static long const_seg(int node, int l, int r) {
              if (l == r) {
                  return seg[node] = arr[l];
              } else {
                  int mid = (l + r) / 2;
                  return seg[node] = gcd(const_seg(2 * node, l, mid), const_seg(2 * node + 1, mid + 1, r));
              }
          }
  
          public static long query(int node, int l, int r, int x, int y) {
              if (x <= l && r <= y) {
                  return seg[node];
              }
              else if (r < x || y < l) {
                  return 0l;
              } else {
                  int mid = (l + r) / 2;
                  return gcd(query(2 * node, l, mid, x, y), query(2 * node + 1, mid + 1, r, x, y));
              }
          }
  
          public void solve(int testNumber, InputReader in, OutputWriter out) {
              int test = in.nextInt();
              while (test-- > 0) {
                  int n = in.nextInt();
                  long array[] = new long[n];
                  for (int i = 0; i < n; i++) {
                      array[i] = in.nextLong();
                  }
                  if (n == 1) {
                      out.println(1);
                      continue;
                  }
                  long diff[] = new long[n - 1];
                  for (int i = 0; i < n - 1; i++) {
                      diff[i] = Math.abs(array[i] - array[i + 1]);
                  }
                  arr = diff;
                  seg = new long[4 * n + 1];
                  const_seg(1, 0, n - 2);
                  int ans = 1,i = 0, j = 0;
                  while (i + ans - 1 < n - 1) {
                      long temp_ans = query(1, 0, n - 2, i, j);
                      if (temp_ans >= 2) {
                          ans = Math.max(ans, j - i + 2);
                      }
                      if (j < n - 2 && temp_ans >= 2) {
                          j++;
                      } else {
                          i++;
                          if (i == j + 1) {
                              j++;
                          }
                      }
                  }
                  out.println(ans);
              }
          }
      }
  
      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(int i) {
              writer.println(i);
          }
  
      }
  
      static class InputReader {
          private InputStream stream;
          private byte[] buf = new byte[1024];
          private int curChar;
          private int numChars;
          private InputReader.SpaceCharFilter filter;
  
          public InputReader(InputStream stream) {
              this.stream = stream;
          }
  
          public int read() {
              if (numChars == -1) {
                  throw new InputMismatchException();
              }
              if (curChar >= numChars) {
                  curChar = 0;
                  try {
                      numChars = stream.read(buf);
                  } catch (IOException e) {
                      throw new InputMismatchException();
                  }
                  if (numChars <= 0) {
                      return -1;
                  }
              }
              return buf[curChar++];
          }
  
          public int nextInt() {
              int c = read();
              while (isSpaceChar(c)) {
                  c = read();
              }
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              int res = 0;
              do {
                  if (c < '0' || c > '9') {
                      throw new InputMismatchException();
                  }
                  res *= 10;
                  res += c - '0';
                  c = read();
              } while (!isSpaceChar(c));
              return res * sgn;
          }
  
          public long nextLong() {
              int c = read();
              while (isSpaceChar(c)) {
                  c = read();
              }
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              long res = 0;
              do {
                  if (c < '0' || c > '9') {
                      throw new InputMismatchException();
                  }
                  res *= 10;
                  res += c - '0';
                  c = read();
              } while (!isSpaceChar(c));
              return res * sgn;
          }
  
          public boolean isSpaceChar(int c) {
              if (filter != null) {
                  return filter.isSpaceChar(c);
              }
              return isWhitespace(c);
          }
  
          public static boolean isWhitespace(int c) {
              return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }
  
          public interface SpaceCharFilter {
              public boolean isSpaceChar(int ch);
  
          }
  
      }
  }