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.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.math.BigInteger;
  import java.util.*;
  
  public class Practice {
  	public static long mod = (long) Math.pow(10, 9) + 7;
  	public static long mod2 = 998244353;
  	public static int tt = 1;
  	public static ArrayList<Integer> prime;
  	public static long[] fac = new long[200005];
  	public static long[] invfac = new long[200005];
  
  	public static void main(String[] args) throws Exception {
  
  		PrintWriter pw = new PrintWriter(System.out);
  		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  		int t = Integer.parseInt(br.readLine());
  		while (t-- > 0) {
  			String[] s1 = br.readLine().split(" ");
  			int n = Integer.parseInt(s1[0]);
  			long[] arr = new long[n];
  			String str = (br.readLine());
  			String[] s2 = str.split(" ");
  			for (int i = 0; i < n; i++) {
  				arr[i] = Long.parseLong(s2[i]);
  			}
  			if (n == 1) {
  				pw.println(1);
  				continue;
  			}
  
  			int ans = 1;
  			long[] gcd = new long[n - 1];
  			for (int i = 1; i < n; i++) {
  				gcd[i - 1] = Math.abs(arr[i] - arr[i - 1]);
  			}
  			long curr = 0;
  			int w = 0;
  			long[] tree = new long[4 * n];
  
  			makeTree(0, gcd, n, tree, 0, n - 2);
  			int p = 0;
  			for (int i = 0; i < n - 1;) {
  				curr = getGCD(curr, gcd[i]);
  				if (gcd[i] == 1) {
  					ans = Math.max(i - w + 1, ans);
  					i++;
  					w = i;
  					curr = 0;
  				}
  				// System.out.println(curr);
  				else if (curr > 1) {
  					i++;
  
  				} else {
  					ans = Math.max(i - w + 1, ans);
  					w++;
  					curr = getAns(0, w, i, tree, 0, n - 2);
  				}
  				// System.out.println(ans + " " + i + " " + curr + " " + w);
  
  			}
  			// System.out.println(w);
  			ans = Math.max(n - w, ans);
  			pw.println(ans);
  		}
  		pw.close();
  
  	}
  
  	private static long getAns(int curr, int l1, int r1, long[] tree, int l, int r) {
  		// TODO Auto-generated method stub
  		if (l > r) {
  			return 0l;
  		}
  		// if()
  		if (l1 > r || r1 < l) {
  			return 0l;
  		}
  		if (l1 <= l && r1 >= r) {
  			return tree[curr];
  		}
  		int mid = (l + r) / 2;
  
  		long ans = getAns(2 * curr + 1, l1, r1, tree, l, mid);
  		ans = getGCD(getAns(2 * curr + 2, l1, r1, tree, mid + 1, r), ans);
  		return ans;
  	}
  
  	private static void makeTree(int curr, long[] gcd, int n, long[] tree, int l, int r) {
  		// TODO Auto-generated method stub
  		if (l == r) {
  			tree[curr] = gcd[l];
  			return;
  		}
  		if (l > r) {
  			return;
  		}
  		int mid = (l + r) / 2;
  		makeTree(2 * curr + 1, gcd, n, tree, l, mid);
  		makeTree(2 * curr + 2, gcd, n, tree, mid + 1, r);
  		tree[curr] = getGCD(tree[2 * curr + 1], tree[2 * curr + 2]);
  		return;
  	}
  
  	private static long getGCD(long l, long m) {
  
  		long t1 = Math.min(l, m);
  		long t2 = Math.max(l, m);
  		if (t1 == 0) {
  			return t2;
  		}
  		while (true) {
  			long temp = t2 % t1;
  			if (temp == 0) {
  				return t1;
  			}
  			t2 = t1;
  			t1 = temp;
  		}
  	}
  
  	// private static int kmp(String str) {
  //		// TODO Auto-generated method stub
  //		// System.out.println(str);
  //		int[] pi = new int[str.length()];
  //		pi[0] = 0;
  //		for (int i = 1; i < str.length(); i++) {
  //			int j = pi[i - 1];
  //			while (j > 0 && str.charAt(i) != str.charAt(j)) {
  //				j = pi[j - 1];
  //			}
  //			if (str.charAt(j) == str.charAt(i)) {
  //				j++;
  //			}
  //			pi[i] = j;
  //			System.out.print(pi[i]);
  //		}
  //		System.out.println();
  //		return pi[str.length() - 1];
  //	}
  
  }
  
  //	private static void getFac(long n, PrintWriter pw) {
  //		// TODO Auto-generated method stub
  //		int a = 0;
  //		while (n % 2 == 0) {
  //			a++;
  //			n = n / 2;
  //		}
  //		if (n == 1) {
  //			a--;
  //		}
  //		for (int i = 3; i <= Math.sqrt(n); i += 2) {
  //			while (n % i == 0) {
  //				n = n / i;
  //				a++;
  //			}
  //		}
  //		if (n > 1) {
  //			a++;
  //		}
  //		if (a % 2 == 0) {
  //			pw.println("Bob");
  //		} else {
  //			pw.println("Alice");
  //		}
  //		//System.out.println(a);
  //		return;
  //	}
  
  //	private static long power(long a, long p) {
  //		// TODO Auto-generated method stub
  //		long res = 1;
  //		while (p > 0) {
  //			if (p % 2 == 1) {
  //				res = (res * a) % mod;
  //			}
  //			p = p / 2;
  //			a = (a * a) % mod;
  //		}
  //		return res;
  //	}
  //
  //	private static void fac() {
  //		fac[0] = 1;
  //		// TODO Auto-generated method stub
  //		for (int i = 1; i < fac.length; i++) {
  //			if (i == 1) {
  //				fac[i] = 1;
  //			} else {
  //				fac[i] = i * fac[i - 1];
  //			}
  //			if (fac[i] > mod) {
  //				fac[i] = fac[i] % mod;
  //			}
  //		}
  //	}
  //
  //	private static int getLower(Long long1, Long[] st) {
  //		// TODO Auto-generated method stub
  //		int left = 0, right = st.length - 1;
  //		int ans = -1;
  //		while (left <= right) {
  //			int mid = (left + right) / 2;
  //			if (st[mid] <= long1) {
  //				ans = mid;
  //				left = mid + 1;
  //			} else {
  //				right = mid - 1;
  //			}
  //		}
  //		return ans;
  //	}
  
  //	private static long getGCD(long l, long m) {
  //
  //		long t1 = Math.min(l, m);
  //		long t2 = Math.max(l, m);
  //		while (true) {
  //			long temp = t2 % t1;
  //			if (temp == 0) {
  //				return t1;
  //			}
  //			t2 = t1;
  //			t1 = temp;
  //		}
  //	}