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.*;
  
  public class D
  {
      static InputReader in=new InputReader(System.in);
      static OutputWriter out=new OutputWriter(System.out);
      static StringBuilder sb=new StringBuilder();
      static int MAX = 4 * 1000000 + 2;
      static int n;
      // Main Class Starts Here
      public static void main(String[] args)throws IOException
      {
          // Write your code.
  
          int t = in();
          while(t-- > 0){
              int n = in();
              long ar[] = lan(n);
  
              int s = n-1;
              long a[] = new long[s];
              for(int i = 0 ;i < s; i++)
                  a[i] = Math.abs(ar[i+1] - ar[i]);
  
              // sparse table.
              long sp[][] = new long[s][18];
              // sp[i][j] = gcd of range a[i, i + (1 << j)]
  
              // initialize sparse table
              for(int i =0 ; i < s; i++)
                  sp[i][0] = a[i];
  
              // construct sparse table
              for(int j = 1; j <= 17; j++){
                  for(int i = 0; i + (1 << j) < s; i++){
                      sp[i][j] = gcd(sp[i][j-1], sp[i + (1 << (j-1))][j-1]);
                  }
              }
  
              // two pointer.
              int l = 0;
              int r = 0;
              int max = 0;
              while(r < s){
                  long gcd = sparseQuery(l, r, sp);
                  if(gcd > 1){
                      max = Math.max(max, (r - l + 1));
                      r++;
                  }
                  else if(gcd == 1){
                      if(r == l)
                          r++;
                      l++;
                  }
              }
              max++;
              app(max+"\n");
          }
          out.printLine(sb);
          out.close();
      }
  
      public static long sparseQuery(int l, int r, long sp[][]){
          long res = 0L;
          while(l <= r){
              if(l == r){
                  res = gcd(res, sp[l][0]);
                  break;
              }
              for(int i = 17; i >= 0; i--){
                  int length = l + (1 << i);
                  if(length > r) continue;
                  res = gcd(res, sp[l][i]);
                  l += 1 << i;
                  break;
              }
          }
          return res;
      }
  
      static class Query{
          int l;
          int r;
          int index;
          int answer;
          public Query(int l, int r, int index){
              this.l = l;
              this.r = r;
              this.index = index;
          }
  
          public void setAnswer(int answer){
              this.answer = answer;
          }
  
          @Override
          public String toString(){
              return "("+(l+1)+","+(r+1)+")";
          }
      }
  
      static class Pair{
          int x, y;
          public Pair(int x, int y){
              this.x = x;
              this.y = y;
          }
  
          @Override
          public String toString(){
              return "("+x+","+y+")";
          }
      }
  
      static class DisjointSet{
          int parent[];
          int rank[];
          int size;
  
          public DisjointSet(int n){
              this.parent = new int[n];
              this.rank = new int[n];
              this.size = n;
              for(int i = 0; i < n; i++)
                  parent[i] = i;
          }
  
          public int findParent(int x){
              if(parent[x] != x){
                  return parent[x] = findParent(parent[x]);
              }
              return parent[x];
          }
  
          public boolean inSameComponents(int x, int y){
              int parentX = findParent(x);
              int parentY = findParent(y);
              return parentX == parentY;
          }
  
          public int mergeComponents(int x, int y){
              int parentX = findParent(x);
              int parentY = findParent(y);
              if(parentX == parentY) {
                  return 0; // merge failed as in the same components hence no change in components
              }
              if(rank[parentX] < rank[parentY]){
                  parent[parentX] = parentY;
              }
              else if(rank[parentX] > rank[parentY]){
                  parent[parentY] = parentX;
              }
              else{
                  // merge component of y to x.
                  parent[parentY] = parentX;
                  rank[parentX]++;
              }
              return 1; // merge successful - decrease in merge components
          }
  
          public int countComponents(){
              int count = 0;
              for(int i = 0; i < size; i++)
                  if(parent[i] == i) count++;
              return count;
          }
  
          public TreeMap<Integer, List<Integer>> getComponents(){
              TreeMap<Integer, List<Integer>> componentMap = new TreeMap<>();
  
              for(int i = 0; i < size; i++){
                  List<Integer> componentElements = componentMap.getOrDefault(parent[i], new ArrayList<>());
                  componentElements.add(i);
                  componentMap.put(parent[i], componentElements);
              }
  
              return componentMap;
          }
  
          public Set<Integer> getComponentsWithNode(int x){
              HashSet<Integer> set = new HashSet<>();
              int parentX = findParent(x);
              for(int i = 0; i < n; i++){
                  if(parent[i] == parentX){
                      set.add(i);
                  }
              }
              return set;
          }
      }
  
      // segment tree.
      static class SegmentTree{
          int size;
          List<Integer> st[];
          int n;
          public SegmentTree(int a[], int n){
              int x = (int)Math.ceil((Math.log(n) / Math.log(2)));
              this.size = (int)Math.pow(2, 2 * x) - 1;
              st = new ArrayList[size];
              buildTree(0, n-1, 0, a);
              this.n = n;
          }
  
          public List<Integer> buildTree(int l, int r, int curIndex, int a[]){
              if(l == r){
                  st[curIndex] =  new ArrayList<>();
                  st[curIndex].add(a[l]);
                  return st[curIndex];
              }
              int mid = (l + r) / 2;
              List<Integer> leftList = buildTree(l, mid, 2 * curIndex + 1, a);
              List<Integer> rightList = buildTree(mid + 1, r, 2 * curIndex + 2, a);
              int lastLeftProduct = leftList.get(leftList.size() - 1);
              int firstRightProduct = rightList.get(0);
              int gcd = gcd(lastLeftProduct, firstRightProduct);
              if(gcd > 1){
                  st[curIndex] = new ArrayList<>(leftList);
                  st[curIndex].addAll(rightList);
              }
              else{
                  st[curIndex] = new ArrayList<>();
                  for(int i = 0; i < leftList.size() - 1; i++)
                      st[curIndex].add(leftList.get(i));
                  st[curIndex].add(lastLeftProduct * firstRightProduct);
                  for(int i = 1 ; i < rightList.size(); i++)
                      st[curIndex].add((rightList.get(i)));
              }
              return st[curIndex];
          }
  
          public int resolveQuery(int ql, int qr){
              List<Integer> ans = mergeRanges(0, n-1, ql, qr, 0);
              return ans.size();
          }
  
          public List<Integer> mergeRanges(int l, int r, int ql, int qr, int curIndex){
              if(l > qr || r < ql) return null;
              if(ql <= l && qr >= r){
                  return st[curIndex];
              }
              int mid = (l + r) / 2;
              List<Integer> leftList = mergeRanges(l, mid, ql, qr, 2 * curIndex + 1);
              List<Integer> rightList = mergeRanges(mid + 1, r, ql, qr, 2 * curIndex + 2);
              if(leftList != null && rightList != null){
                  int lastLeftProduct = leftList.get(leftList.size() - 1);
                  int firstRightProduct = rightList.get(0);
                  int gcd = gcd(lastLeftProduct, firstRightProduct);
                  List<Integer> mergedList = new ArrayList<>();
                  if(gcd > 1){
                      mergedList.addAll(leftList);
                      mergedList.addAll(rightList);
                  }
                  else{
                      for(int i = 0; i < leftList.size() - 1; i++)
                          mergedList.add(leftList.get(i));
                      mergedList.add(lastLeftProduct * firstRightProduct);
                      for(int i = 1 ; i < rightList.size(); i++)
                          mergedList.add((rightList.get(i)));
                  }
                  return mergedList;
              }
              else if(leftList != null) return leftList;
              else return rightList;
          }
  
          public void printTree(){
              for(int i = 0; i < st.length; i++)
                  prln(i+" , "+st[i]);
          }
      }
  
      public static String atsi(int a[]){
          return Arrays.toString(a);
      }
  
      public static String atsl(long a[]){
          return Arrays.toString(a);
      }
  
      public static long gcd(long a, long b){
          if(b == 0) return a;
          return gcd(b, a % b);
      }
  
      public static int gcd(int a, int b){
          if(b == 0) return a;
          return gcd(b, a % b);
      }
  
      public static int[] an(int n) {
          int ar[]=new int[n];
          for(int i=0;i<n;i++)
              ar[i]=in();
          return ar;
      }
  
      public static long[] lan(int n) {
          long ar[]=new long[n];
          for(int i=0;i<n;i++)
              ar[i]=lin();
          return ar;
      }
  
      public static String atos(Object ar[]) {
          return Arrays.toString(ar);
      }
  
      public static int in() {
          return in.readInt();
      }
  
      public static long lin() {
          return in.readLong();
      }
  
      public static String sn() {
          return in.readString();
      }
  
      public static void prln(Object o) {
          out.printLine(o);
      }
  
      public static void prn(Object o) {
          out.print(o);
      }
  
      public static void app(Object o) {
          sb.append(o);
      }
  
  
      static class InputReader {
          private InputStream stream;
          private byte[] buf = new byte[1024];
          private int curChar;
          private int numChars;
          private 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 readInt() {
              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 readLong() {
              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 String readString() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              StringBuilder res = new StringBuilder();
              do {
                  res.appendCodePoint(c);
                  c = read();
              } while (!isSpaceChar(c));
              return res.toString();
          }
  
          public boolean isSpaceChar(int c) {
              if (filter != null)
                  return filter.isSpaceChar(c);
              return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }
  
          public String next() {
              return readString();
          }
  
          public interface SpaceCharFilter {
              public boolean isSpaceChar(int ch);
          }
      }
  
      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 print(Object...objects) {
              for (int i = 0; i < objects.length; i++) {
                  if (i != 0)
                      writer.print(' ');
                  writer.print(objects[i]);
              }
          }
  
          public void printLine(Object...objects) {
              print(objects);
              writer.println();
          }
  
          public void close() {
              writer.close();
          }
      }
  }