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.util.function.BinaryOperator;
  
  public class D{
      static class InputReader {
          private static final int DEFAULT_BUFFER_SIZE = 1 << 16; // Change this to increase your input size //
          private static final InputStream DEFAULT_STREAM = System.in;private static final int MAX_DECIMAL_PRECISION = 21;private int c;private byte[] buf;
          private int bufferSize, bufIndex, numBytesRead;private InputStream stream;private static final byte EOF = -1;private static final byte NEW_LINE = 10;
          private static final byte CARRIAGE_RETURN = 13;private static final byte SPACE = 32;private static final byte DASH = 45;private static final byte DOT = 46;
          private char[] charBuffer;private static byte[] bytes = new byte[58];private static int[] ints = new int[58];private static char[] chars = new char[128];
          static { char ch = ' ';int value = 0;byte _byte = 0;for (int i = 48; i < 58; i++) bytes[i] = _byte++;for (int i = 48; i < 58; i++) ints[i] = value++;for (int i = 32; i < 128; i++) chars[i] = ch++; }
          public InputReader() { this(DEFAULT_STREAM, DEFAULT_BUFFER_SIZE); }public InputReader(int bufferSize) { this(DEFAULT_STREAM, bufferSize); }public InputReader(InputStream stream) { this(stream, DEFAULT_BUFFER_SIZE); }
          public InputReader(InputStream stream, int bufferSize) { if (stream == null || bufferSize <= 0) throw new IllegalArgumentException();buf = new byte[bufferSize];charBuffer = new char[128];this.bufferSize = bufferSize;this.stream = stream; }
          private byte read() throws IOException { if (numBytesRead == EOF) throw new IOException();if (bufIndex >= numBytesRead) { bufIndex = 0;numBytesRead = stream.read(buf);if (numBytesRead == EOF) return EOF; }return buf[bufIndex++]; }
          private int readJunk(int token) throws IOException { if (numBytesRead == EOF) return EOF;do { while (bufIndex < numBytesRead) { if (buf[bufIndex] > token) return 0;bufIndex++; }numBytesRead = stream.read(buf);if (numBytesRead == EOF) return EOF;bufIndex = 0; } while (true); }
          public byte nextByte() throws IOException {return (byte) ni(); }
          public int ni() throws IOException { if (readJunk(DASH - 1) == EOF) throw new IOException();int sgn = 1, res = 0;c = buf[bufIndex];if (c == DASH) { sgn = -1;bufIndex++; } do { while (bufIndex < numBytesRead)
          { if (buf[bufIndex] > SPACE) { res = (res << 3) + (res << 1);res += ints[buf[bufIndex++]]; } else { bufIndex++;return res * sgn; } }numBytesRead = stream.read(buf);if (numBytesRead == EOF) return res * sgn;bufIndex = 0; } while (true); }
          public long nl() throws IOException { if (readJunk(DASH - 1) == EOF) throw new IOException();int sgn = 1;long res = 0L;c = buf[bufIndex];if (c == DASH) { sgn = -1;bufIndex++; } do { while (bufIndex < numBytesRead)
          { if (buf[bufIndex] > SPACE) { res = (res << 3) + (res << 1);res += ints[buf[bufIndex++]]; } else { bufIndex++;return res * sgn; } }numBytesRead = stream.read(buf);if (numBytesRead == EOF) return res * sgn;bufIndex = 0; } while (true); }
          private void doubleCharBufferSize() { char[] newBuffer = new char[charBuffer.length << 1];for (int i = 0; i < charBuffer.length; i++) newBuffer[i] = charBuffer[i];charBuffer = newBuffer; }
          public String nli() throws IOException { try { c = read(); } catch (IOException e) { return null; }if (c == NEW_LINE) return "";
              if (c == EOF) return null;int i = 0;charBuffer[i++] = (char) c;do { while (bufIndex < numBytesRead) { if (buf[bufIndex] != NEW_LINE && buf[bufIndex] != CARRIAGE_RETURN)
              { if (i == charBuffer.length) doubleCharBufferSize();charBuffer[i++] = (char) buf[bufIndex++]; } else { if(buf[bufIndex] == CARRIAGE_RETURN) bufIndex++;bufIndex++;
                  return new String(charBuffer, 0, i); } }numBytesRead = stream.read(buf);if (numBytesRead == EOF) return new String(charBuffer, 0, i);bufIndex = 0; } while (true); }
          public String ns() throws IOException { if (numBytesRead == EOF) return null;if (readJunk(SPACE) == EOF) return null;for (int i = 0; ; )
          { while (bufIndex < numBytesRead) { if (buf[bufIndex] > SPACE) { if (i == charBuffer.length) doubleCharBufferSize();charBuffer[i++] = (char) buf[bufIndex++]; }
          else {bufIndex++;return new String(charBuffer, 0, i); } }numBytesRead = stream.read(buf);if (numBytesRead == EOF) return new String(charBuffer, 0, i);bufIndex = 0; } }
          public double nd() throws IOException { String doubleVal = ns();if (doubleVal == null) throw new IOException();return Double.valueOf(doubleVal); }
          public void close() throws IOException {stream.close(); }
      }
  
      // region variables
      static InputReader sc = new InputReader();
      static OutputStream outputStream = System.out;
      static PrintWriter w = new PrintWriter(outputStream);
      // endregion
  
      private static void initiateIO()
              throws IOException {if (System.getProperty("ONLINE_JUDGE") == null) {
          try { w = new PrintWriter("output.txt");
              sc = new InputReader(new FileInputStream("input.txt"));
          } catch (Exception e) { throw new IOException(); }} }
  
      public static void main(String[] args)
              throws IOException {
  
          initiateIO();
  //
  
          int t = sc.ni();
          while(t-- > 0)
              solve();
  
          w.close();
  
      }
  
      static void solve() throws IOException {
          long n = sc.nl();
          long[] arr = new long[(int)n];
  
          for(int i = 0; i < n; i++) {
              arr[i] = sc.nl();
          }
          
          if(n == 1) {
              w.println(1);
              return;
          }
  
  
          long[] diff = new long[(int)n-1];
  
          for(int i = 0; i < n-1; i++) {
              diff[i] = Math.abs(arr[i] - arr[i+1]);
          }
  
          SparseTable st = new SparseTable(diff, SparseTable.Operation.GCD);
  
          int l = 0;
          int r = 0;
          long ans = 0;
  
          for(int i = 0; i < diff.length; i++) {
              l = i; r = diff.length-1;
              while (l <= r) {
                  int mid = (l+r)/2;
                  long q = st.query(i, mid);
                  if(q > 1) {
                      ans = Math.max(ans, mid-i+1);
                      l = mid+1;
                  } else {
                      r = mid-1;
                  }
              }
          }
  
          w.println((ans+1));
  
      }
  
       /**
            * Sparse table only supports immutable structures
            * <p>Specify the operation using "Operation" public enum in the constructor</p>
            * Enter the range on which you want to perform query [l, r] both inclusive
            * <p>min, max and gcd queries are constant</p>
            * sum query is logarithmic
            * <p> query index is used to find the index of the min/max values</p>
            */
           // region SparseTable
           static class SparseTable {
  
               // The number of elements in the original input array.
               private int n;
  
               // The maximum power of 2 needed. This value is floor(log2(n))
               private int P;
  
               // Fast log base 2 logarithm lookup table for i, 1 <= i <= n
               private int[] log2;
  
               // The sparse table values.
               private long[][] dp;
  
               // Index Table (IT) associated with the values in the sparse table.
               private int[][] it;
  
               // The various supported query operations on this sparse table.
               public enum Operation {
                   MIN,
                   MAX,
                   SUM,
                   MULT,
                   GCD
               }
  
               ;
  
               private Operation op;
  
               // All functions must be associative, e.g: a * (b * c) = (a * b) * c for some operation '*'
               private BinaryOperator<Long> sumFn = (a, b) -> a + b;
               private BinaryOperator<Long> minFn = (a, b) -> Math.min(a, b);
               private BinaryOperator<Long> maxFn = (a, b) -> Math.max(a, b);
               private BinaryOperator<Long> multFn = (a, b) -> a * b;
               private BinaryOperator<Long> gcdFn =
                       (a, b) -> {
                           long gcd = a;
                           while (b != 0) {
                               gcd = b;
                               b = a % b;
                               a = gcd;
                           }
                           return Math.abs(gcd);
                       };
  
               public SparseTable(long[] values, Operation op) {
                   // TODO(william): Lazily call init in query methods instead of initializing in constructor?
                   this.op = op;
                   init(values);
               }
  
               private void init(long[] v) {
                   n = v.length;
  
                   // Tip: to get the floor of the logarithm base 2 in Java you can also do:
                   // Integer.numberOfTrailingZeros(Integer.highestOneBit(n)).
                   P = (int) (Math.log(n) / Math.log(2));
                   dp = new long[P + 1][n];
                   it = new int[P + 1][n];
  
                   for (int i = 0; i < n; i++) {
                       dp[0][i] = v[i];
                       it[0][i] = i;
                   }
  
                   log2 = new int[n + 1];
                   for (int i = 2; i <= n; i++) {
                       log2[i] = log2[i / 2] + 1;
                   }
  
                   // Build sparse table combining the values of the previous intervals.
                   for (int i = 1; i <= P; i++) {
                       for (int j = 0; j + (1 << i) <= n; j++) {
                           long leftInterval = dp[i - 1][j];
                           long rightInterval = dp[i - 1][j + (1 << (i - 1))];  // [j+(1<<(i-1))] = j + 2^(i-1) // Watch in insertion slides for more info
                           if (op == Operation.MIN) {
                               dp[i][j] = minFn.apply(leftInterval, rightInterval);
                               // Propagate the index of the best value
                               if (leftInterval <= rightInterval) {
                                   it[i][j] = it[i - 1][j];
                               } else {
                                   it[i][j] = it[i - 1][j + (1 << (i - 1))];
                               }
                           } else if (op == Operation.MAX) {
                               dp[i][j] = maxFn.apply(leftInterval, rightInterval);
                               // Propagate the index of the best value
                               if (leftInterval >= rightInterval) {
                                   it[i][j] = it[i - 1][j];
                               } else {
                                   it[i][j] = it[i - 1][j + (1 << (i - 1))];
                               }
                           } else if (op == Operation.SUM) {
                               dp[i][j] = sumFn.apply(leftInterval, rightInterval);
                           } else if (op == Operation.MULT) {
                               dp[i][j] = multFn.apply(leftInterval, rightInterval);
                           } else if (op == Operation.GCD) {
                               dp[i][j] = gcdFn.apply(leftInterval, rightInterval);
                           }
                       }
                   }
                   // Uncomment for debugging
                   // printTable();
               }
  
               // For debugging, testing and slides.
               private void printTable() {
                   for (long[] r : dp) {
                       for (int i = 0; i < r.length; i++) {
                           System.out.printf("%02d, ", r[i]);
                       }
                       System.out.println();
                   }
               }
  
               // Queries [l, r] for the operation set on this sparse table.
               public long query(int l, int r) {
                   // Fast queries types, O(1)
                   if (op == Operation.MIN) {
                       return query(l, r, minFn);
                   } else if (op == Operation.MAX) {
                       return query(l, r, maxFn);
                   } else if (op == Operation.GCD) {
                       return query(l, r, gcdFn);
                   }
  
                   // Slower query types, O(log2(n))
                   if (op == Operation.SUM) {
                       return sumQuery(l, r);
                   } else {
                       return multQuery(l, r);
                   }
               }
  
               public int queryIndex(int l, int r) {
                   if (op == Operation.MIN) {
                       return minQueryIndex(l, r);
                   } else if (op == Operation.MAX) {
                       return maxQueryIndex(l, r);
                   }
                   throw new UnsupportedOperationException(
                           "Operation type: " + op + " doesn't support index queries :/");
               }
  
               private int minQueryIndex(int l, int r) {
                   int len = r - l + 1;
                   int p = log2[len];
                   long leftInterval = dp[p][l];
                   long rightInterval = dp[p][r - (1 << p) + 1];
                   if (leftInterval <= rightInterval) {
                       return it[p][l];
                   } else {
                       return it[p][r - (1 << p) + 1];
                   }
               }
  
               private int maxQueryIndex(int l, int r) {
                   int len = r - l + 1;
                   int p = log2[len];
                   long leftInterval = dp[p][l];
                   long rightInterval = dp[p][r - (1 << p) + 1];
                   if (leftInterval >= rightInterval) {
                       return it[p][l];
                   } else {
                       return it[p][r - (1 << p) + 1];
                   }
               }
  
               // Do sum query [l, r] in O(log2(n)).
               //
               // Perform a cascading query which shrinks the left endpoint while summing over all the intervals
               // which are powers of 2 between [l, r].
               //
               // WARNING: This method can easily produces values that overflow.
               //
               // NOTE: You can achieve a faster time complexity and use less memory with a simple prefix sum
               // array. This method is here more as a proof of concept than for its usefulness.
               private long sumQuery(int l, int r) {
                   long sum = 0;
                   for (int p = log2[r - l + 1]; l <= r; p = log2[r - l + 1]) {
                       sum += dp[p][l];
                       l += (1 << p);
                   }
                   return sum;
               }
  
               private long multQuery(int l, int r) {
                   long result = 1;
                   for (int p = log2[r - l + 1]; l <= r; p = log2[r - l + 1]) {
                       result *= dp[p][l];
                       l += (1 << p);
                   }
                   return result;
               }
  
               // Do either a min, max or gcd query on the interval [l, r] in O(1).
               //
               // We can get O(1) query by finding the smallest power of 2 that fits within the interval length
               // which we'll call k. Then we can query the intervals [l, l+k] and [r-k+1, r] (which likely
               // overlap) and apply the function again. Some functions (like min and max) don't care about
               // overlapping intervals so this trick works, but for a function like sum this would return the
               // wrong result since it is not an idempotent binary function.
               private long query(int l, int r, BinaryOperator<Long> fn) {
                   int len = r - l + 1;
                   int p = log2[len];
                   return fn.apply(dp[p][l], dp[p][r - (1 << p) + 1]);
               }
           }
           // endregion
  }