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.InputStream;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashSet;
  import java.util.LinkedList;
  import java.util.Queue;
  import java.util.Scanner;
  import java.util.StringTokenizer;
  import java.util.TreeSet;
  
  public class D {
  
  	static boolean cheak(int mid, SegmentTree sg, int n) {
  		for (int i = 1; i + mid <= n; i++) {
  			long gcd = sg.query(i, i + mid - 1);
  			if (gcd != 1)
  				return true;
  		}
  		return false;
  	}
  
  	public static void main(String[] args) throws IOException {
  		Scanner sc = new Scanner(System.in);
  		PrintWriter pw = new PrintWriter(System.out);
  
  //		sieve(1000);
  
  		int t = sc.nextInt();
  		while (t-- > 0) {
  			int n = sc.nextInt();
  			long[] a = new long[n];
  			int N = 1;
  			while (N < n - 1)
  				N <<= 1;
  			long[] in = new long[N + 1];
  			Arrays.fill(in, 1);
  			a[0] = sc.nextLong();
  			for (int i = 1; i < a.length; i++) {
  				a[i] = sc.nextLong();
  				in[i] = Math.abs(a[i] - a[i - 1]);
  			}
  			SegmentTree sg = new SegmentTree(in);
  
  //			System.out.println(sg.query(1, 2));
  //			int s = 1;
  //			int e = n-1;
  //			int max = 1;
  //			while (s <= e) {
  //				int mid = s + e >> 1;
  //				if (cheak(mid, sg, n)) {
  //					max = mid+1;
  //					s = mid + 1;
  //				} else {
  //					e = mid - 1;
  //				}
  //			}
  			int ans = 1;
  			int j = 1;
  
  			for (int i = 1; i < n; i++) {
  				j = Math.max(j, i);
  				while (j < n && sg.query(i, j) > 1)
  					j++;
  				ans = Math.max(ans, j - i + 1);
  			}
  
  			pw.println(ans);
  		}
  
  		pw.flush();
  	}
  
  	static class SegmentTree { // 1-based DS, OOP
  
  		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
  		long[] array, sTree, lazy;
  
  		SegmentTree(long[] in) {
  			array = in;
  			N = in.length - 1;
  			sTree = new long[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero
  			lazy = new long[N << 1];
  			build(1, 1, N);
  		}
  
  		void build(int node, int b, int e) // O(n)
  		{
  			if (b == e)
  				sTree[node] = array[b];
  			else {
  				int mid = b + e >> 1;
  				build(node << 1, b, mid);
  				build(node << 1 | 1, mid + 1, e);
  				sTree[node] = gcd(sTree[node << 1], sTree[node << 1 | 1]);
  			}
  		}
  
  		long query(int i, int j) {
  			return query(1, 1, N, i, j);
  		}
  
  		long query(int node, int b, int e, int i, int j) // O(log n)
  		{
  			if (i > e || j < b)
  				return 0;
  			if (b >= i && e <= j)
  				return sTree[node];
  			int mid = b + e >> 1;
  			long q1 = query(node << 1, b, mid, i, j);
  			long q2 = query(node << 1 | 1, mid + 1, e, i, j);
  			return gcd(q1, q2);
  
  		}
  
  	}
  
  	static long gcd(long a, long b) {
  		if (a == 0)
  			return b;
  		return gcd(b % a, a);
  	}
  
  	static int[][] a;
  	static int n, m;
  
  	static int fill() {
  		int c = 1;
  		for (int i = 0; i < m; i++) {
  			if (check(0, i)) {
  				a[0][i] = 1;
  				c++;
  			}
  		}
  		for (int i = 0; i < a.length; i++) {
  			if (check(i, m - 1)) {
  				a[i][m - 1] = 1;
  				c++;
  			}
  		}
  		for (int i = m - 1; i > -1; i--) {
  			if (check(n - 1, i)) {
  				a[n - 1][i] = 1;
  				c++;
  			}
  		}
  		for (int i = n - 1; i > -1; i--) {
  			if (check(i, 0)) {
  				a[i][0] = 1;
  				c++;
  			}
  		}
  		return c;
  
  	}
  
  	static boolean check(int i, int j) {
  		boolean f = (a[i][j] != 1);
  		f &= helper(i - 1, j) && helper(i, j - 1) && helper(i + 1, j) && helper(i, j + 1) && helper(i - 1, j - 1)
  				&& helper(i - 1, j + 1) && helper(i + 1, j - 1) && helper(i + 1, j + 1);
  
  		return f;
  	}
  
  	static boolean helper(int i, int j) {
  		if (i < n && i > -1 && j < m && j > -1)
  			return a[i][j] != 1;
  		return true;
  	}
  
  	static ArrayList<Integer>[] g;
  	static int[] tour;
  	static int idx;
  
  	static void query(ArrayList<Integer> arr) {
  		System.out.print("? " + (arr.size()));
  		for (int x : arr)
  			System.out.print(" " + x);
  		System.out.println();
  	}
  
  	static ArrayList<Integer> findSet(int s, int e) {
  		TreeSet<Integer> tr = new TreeSet<Integer>();
  		for (int i = s; i <= e; i++) {
  			tr.add(tour[i]);
  		}
  		ArrayList<Integer> ret = new ArrayList<Integer>();
  		for (int x : tr)
  			ret.add(x);
  		return ret;
  	}
  
  	static void go(int u, int p) {
  		tour[idx++] = u + 1;
  		for (int v : g[u]) {
  			if (v == p)
  				continue;
  			go(v, u);
  		}
  		tour[idx++] = u + 1;
  	}
  
  	static long[] fac;
  	static int mod = 998244353;
  
  	static void fac() {
  		fac[0] = 1;
  		for (int j = 1; j < fac.length; j++) {
  			fac[j] = fac[j - 1] * j;
  			fac[j] %= mod;
  		}
  	}
  
  	static long inverse(long n) {
  		return modPow(n, mod - 2, mod);
  	}
  
  	static long nc(int n, int r) {
  		return ((fac[n] * inverse(fac[r])) % mod) * inverse(fac[n - r]) % mod;
  	}
  
  	static long modPow(long a, long e, int mod) // O(log e)
  	{
  		a %= mod;
  		long res = 1;
  		while (e > 0) {
  			if ((e & 1) == 1)
  				res = (res * a) % mod;
  			a = (a * a) % mod;
  			e >>= 1;
  		}
  		return res;
  	}
  
  	static class Scanner {
  		StringTokenizer st;
  		BufferedReader br;
  
  		public Scanner(InputStream s) {
  			br = new BufferedReader(new InputStreamReader(s));
  		}
  
  		public String next() throws IOException {
  			while (st == null || !st.hasMoreTokens())
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
  
  		public int nextInt() throws IOException {
  			return Integer.parseInt(next());
  		}
  
  		public long nextLong() throws IOException {
  			return Long.parseLong(next());
  		}
  
  		public String nextLine() throws IOException {
  			return br.readLine();
  		}
  
  		public double nextDouble() throws IOException {
  			String x = next();
  			StringBuilder sb = new StringBuilder("0");
  			double res = 0, f = 1;
  			boolean dec = false, neg = false;
  			int start = 0;
  			if (x.charAt(0) == '-') {
  				neg = true;
  				start++;
  			}
  			for (int i = start; i < x.length(); i++)
  				if (x.charAt(i) == '.') {
  					res = Long.parseLong(sb.toString());
  					sb = new StringBuilder("0");
  					dec = true;
  				} else {
  					sb.append(x.charAt(i));
  					if (dec)
  						f *= 10;
  				}
  			res += Long.parseLong(sb.toString()) / f;
  			return res * (neg ? -1 : 1);
  		}
  
  		public boolean ready() throws IOException {
  			return br.ready();
  		}
  
  	}
  
  }
  