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.*;
  import java.util.function.Function;
  
  public class D {
  
  	private static FastScanner fs = new FastScanner();
  
  	public static void main(String[] args) throws IOException {
  		int cases = fs.nextInt();
  		while (cases-- > 0)
  			solve();
  	}
  	static void solve() throws IOException {
  		int n = fs.nextInt();
  		long[] a = fs.nextLongs(n);
  		if (n == 1) {
  			System.out.println(1);
  			return;
  		}
  		long[] b = new long[n-1];
  		for (int i = 0; i < n-1; i++) {
  			b[i] = Math.abs(a[i+1] - a[i]);
  		}
  		SparseTable st = new SparseTable(b);
  //		System.out.println(st);
  		int l = 0;
  		int h = n-1;
  		while (l<h) {
  			int mid = (l + h)/2;
  //			System.out.println("low: " + l + " " + "high: " + h + " " + mid);
  			boolean found = false;
  			for (int i = 0; i < n-mid-1; i++) {
  				if (st.query(i,i+mid) > 1) {
  					found = true;
  					break;
  				}
  			}
  			if (found) l = mid+1;
  			else h = mid;
  		}
  		System.out.println(l+1);
  	}
  
  
  	static class SparseTable {
  		int n;
  		long[][] mat;
  
  		SparseTable(int[] a) {
  			this(Arrays.stream(a).asLongStream().toArray());
  		}
  		SparseTable(long[] a) {
  			n = a.length;
  			int max_log = 32 - Integer.numberOfLeadingZeros(n);
  			mat = new long[max_log][n];
  			mat[0] = a;
  			for (int j = 1; j < max_log; j++) {
  				for (int i = 0; i <= n - (1 << j); i++) {
  					mat[j][i] = func(mat[j - 1][i], mat[j - 1][i + (1 << (j - 1))]);
  				}
  			}
  		}
  
  		private long func(long l1, long l2) {
  			return gcd(l1,l2);
  		}
  
  		long query(int from, int to) {
  			assert(0 <= from && from <= to && to <= n - 1);
  			int lg = 32 - Integer.numberOfLeadingZeros(to - from + 1) - 1;
  			return func(mat[lg][from], mat[lg][to - (1 << lg) + 1]);
  		}
  
  		@Override
  		public String toString() {
  			StringBuilder sb = new StringBuilder();
  			sb.append("SparseTable{\n");
  			for (long[] longs : mat) {
  				sb.append(Arrays.toString(longs)).append("\n");
  			}
  			sb.append('}');
  			return sb.toString();
  		}
  	}
  
  	static long lcm(long a,long b) {
  	    	return (a/gcd(a,b))*b;
  	    }
  
  	static long gcd(long a, long b) {
  	    if (b == 0)
  	        return a;
  	    return gcd(b, a % b);
  	}
  
  	static class FastScanner
  	{
  		//I don't understand how this works lmao
  		private int BS = 1 << 16;
  		private char NC = (char) 0;
  		private byte[] buf = new byte[BS];
  		private int bId = 0, size = 0;
  		private char c = NC;
  		private double cnt = 1;
  		private BufferedInputStream in;
  
  		public FastScanner() {
  			in = new BufferedInputStream(System.in, BS);
  		}
  
  		public FastScanner(String s) {
  			try {
  				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
  			} catch (Exception e) {
  				in = new BufferedInputStream(System.in, BS);
  			}
  		}
  
  		private char getChar() {
  			while (bId == size) {
  				try {
  					size = in.read(buf);
  				} catch (Exception e) {
  					return NC;
  				}
  				if (size == -1) return NC;
  				bId = 0;
  			}
  			return (char) buf[bId++];
  		}
  
  		public int nextInt() {
  			return (int) nextLong();
  		}
  
  		public int[] nextInts(int N) {
  			int[] res = new int[N];
  			for (int i = 0; i < N; i++) {
  				res[i] = (int) nextLong();
  			}
  			return res;
  		}
  
  		public ArrayList<Integer> nextIntsArrayList(int N) {
  			ArrayList<Integer> res = new ArrayList<>(N);
  			for (int i = 0; i < N; i++) {
  				res.add((int) nextLong());
  			}
  			return res;
  		}
  
  		public long[] nextLongs(int N) {
  			long[] res = new long[N];
  			for (int i = 0; i < N; i++) {
  				res[i] = nextLong();
  			}
  			return res;
  		}
  
  		public long nextLong() {
  			cnt = 1;
  			boolean neg = false;
  			if (c == NC) c = getChar();
  			for (; (c < '0' || c > '9'); c = getChar()) {
  				if (c == '-') neg = true;
  			}
  			long res = 0;
  			for (; c >= '0' && c <= '9'; c = getChar()) {
  				res = (res << 3) + (res << 1) + c - '0';
  				cnt *= 10;
  			}
  			return neg ? -res : res;
  		}
  
  		public double nextDouble() {
  			double cur = nextLong();
  			return c != '.' ? cur : cur + nextLong() / cnt;
  		}
  
  		public double[] nextDoubles(int N) {
  			double[] res = new double[N];
  			for (int i = 0; i < N; i++) {
  				res[i] = nextDouble();
  			}
  			return res;
  		}
  
  		public String next() {
  			StringBuilder res = new StringBuilder();
  			while (c <= 32) c = getChar();
  			while (c > 32) {
  				res.append(c);
  				c = getChar();
  			}
  			return res.toString();
  		}
  
  		public String nextLine() {
  			StringBuilder res = new StringBuilder();
  			while (c <= 32) c = getChar();
  			while (c != '\n') {
  				res.append(c);
  				c = getChar();
  			}
  			return res.toString();
  		}
  
  		public boolean hasNext() {
  			if (c > 32) return true;
  			while (true) {
  				c = getChar();
  				if (c == NC) return false;
  				else if (c > 32) return true;
  			}
  		}
  	}
  }