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.util.Arrays;
  import java.util.StringTokenizer;
  import java.util.*;
  
  public class IntegersHaveFriends {
  
  	static class FastScanner {
  		BufferedReader br;
  		StringTokenizer st;
  
  		public FastScanner() {
  			br = new BufferedReader(new InputStreamReader(System.in));
  		}
  
  		String next() {
  			while (st == null || !st.hasMoreElements()) {
  				try {
  					st = new StringTokenizer(br.readLine());
  				} catch (IOException e) {
  					e.printStackTrace();
  				}
  			}
  			return st.nextToken();
  		}
  
  		int nextInt() {
  			return Integer.parseInt(next());
  		}
  
  		long nextLong() {
  			return Long.parseLong(next());
  		}
  
  		double nextDouble() {
  			return Double.parseDouble(next());
  		}
  
  		String nextLine() {
  			String str = "";
  			try {
  				str = br.readLine();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  			return str;
  		}
  	}
  
  	public static void main(String[] args) {
  
  		FastScanner f = new FastScanner();
  		PrintWriter p = new PrintWriter(System.out);
  		int t = f.nextInt();
  		while (t-- > 0) {
  			int n = f.nextInt();
  			long arr[] = new long[n];
  			for (int i = 0; i < n; i++)
  				arr[i] = f.nextLong();
  			long diff[] = new long[n - 1];
  			for (int i = 1; i < n; i++) {
  				diff[i - 1] = Math.abs(arr[i] - arr[i - 1]);
  			}
  
  			// 2^18=262144
  			// BUILDING SPARSE TABLE
  			long table[][] = new long[18][n - 1];
  			for (int i = 0; i < n - 1; i++) {
  				table[0][i] = diff[i];
  			}
  			for (int i = 1; i < 18; i++) {
  				for (int j = 0; j < n - (1 << i); j++) {
  					table[i][j] = gcd(table[i - 1][j], table[i - 1][j + (1 << (i - 1))]);
  				}
  			}
  
  			int ans = 1;
  			for (int j = 0; j < n - 1; j++) {
  				if (table[0][j] == 1)
  					continue;
  				int curr = j;
  				long g = Long.MAX_VALUE;
  				for (int i = 17; i >= 0; i--) {
  					if (curr == n - 1)
  						break;
  					if (table[i][curr] >= 2 && (g == Long.MAX_VALUE || gcd(g, table[i][curr]) >= 2)) {
  						if (g == Long.MAX_VALUE) {
  							g = table[i][curr];
  						} else {
  							g = gcd(g, table[i][curr]);
  						}
  						curr += (1 << i);
  					}
  				}
  				ans = Math.max(ans, curr - j + 1);
  			}
  			p.println(ans);
  		}
  		p.close();
  
  	}
  
  	// will work till array size of 65537---fastest sorting time
  //	static long[] radixSort(long[] f) {
  //		return radixSort(f, f.length);
  //	}
  //
  //	static long[] radixSort(long[] f, int n) {
  //		long[] to = new long[n];
  //		{
  //			int[] b = new int[65537];
  //			for (int i = 0; i < n; i++)
  //				b[1 + (int) (f[i] & 0xffff)]++;
  //			for (int i = 1; i <= 65536; i++)
  //				b[i] += b[i - 1];
  //			for (int i = 0; i < n; i++)
  //				to[b[(int) (f[i] & 0xffff)]++] = f[i];
  //			long[] d = f;
  //			f = to;
  //			to = d;
  //		}
  //		{
  //			int[] b = new int[65537];
  //			for (int i = 0; i < n; i++)
  //				b[1 + (int) (f[i] >>> 16 & 0xffff)]++;
  //			for (int i = 1; i <= 65536; i++)
  //				b[i] += b[i - 1];
  //			for (int i = 0; i < n; i++)
  //				to[b[(int) (f[i] >>> 16 & 0xffff)]++] = f[i];
  //			long[] d = f;
  //			f = to;
  //			to = d;
  //		}
  //		{
  //			int[] b = new int[65537];
  //			for (int i = 0; i < n; i++)
  //				b[1 + (int) (f[i] >>> 32 & 0xffff)]++;
  //			for (int i = 1; i <= 65536; i++)
  //				b[i] += b[i - 1];
  //			for (int i = 0; i < n; i++)
  //				to[b[(int) (f[i] >>> 32 & 0xffff)]++] = f[i];
  //			long[] d = f;
  //			f = to;
  //			to = d;
  //		}
  //		{
  //			int[] b = new int[65537];
  //			for (int i = 0; i < n; i++)
  //				b[1 + (int) (f[i] >>> 48 & 0xffff)]++;
  //			for (int i = 1; i <= 65536; i++)
  //				b[i] += b[i - 1];
  //			for (int i = 0; i < n; i++)
  //				to[b[(int) (f[i] >>> 48 & 0xffff)]++] = f[i];
  //			long[] d = f;
  //			f = to;
  //			to = d;
  //		}
  //		return f;
  //	}
  
  	// Function to sort an array using quick sort algorithm.
  	static void quickSort(long arr[], int low, int high) {
  		if (low < high) {
  			int p = partition(arr, low, high);
  			quickSort(arr, low, p - 1);
  			quickSort(arr, p + 1, high);
  		}
  	}
  
  	static int partition(long arr[], int low, int high) {
  		long pivot = arr[high];
  		int i = low - 1;
  		for (int j = low; j < high; j++) {
  			if (arr[j] < pivot) {
  				i++;
  				long temp = arr[i];
  				arr[i] = arr[j];
  				arr[j] = temp;
  			}
  		}
  		long temp = arr[i + 1];
  		arr[i + 1] = arr[high];
  		arr[high] = temp;
  
  		return i + 1;
  	}
  
  	/// Ceils
  	static long ceil(long x, long m) {
  		long res = x / m;
  		if (x % m != 0) {
  			res++;
  		}
  		return res;
  	}
  
  	// ------------------------------------------------------------------------------------------------
  	// makes the prefix sum array
  	static long[] prefixSum(long arr[], int n) {
  		long psum[] = new long[n];
  		psum[0] = arr[0];
  		for (int i = 1; i < n; i++) {
  			psum[i] = psum[i - 1] + arr[i];
  		}
  		return psum;
  	}
  	// ------------------------------------------------------------------------------------------------
  
  	// makes the suffix sum array
  	static long[] suffixSum(long arr[], int n) {
  		long ssum[] = new long[n];
  		ssum[n - 1] = arr[n - 1];
  		for (int i = n - 2; i >= 0; i--) {
  			ssum[i] = ssum[i + 1] + arr[i];
  		}
  		return ssum;
  	}
  
  //------------------------------------------------------------------------------------------
  	// BINARY EXPONENTIATION OF A NUMBER MODULO M FASTER METHOD WITHOUT RECURSIVE
  	// OVERHEADS
  	static long m = (long) (1e9 + 7);
  
  	static long binPower(long a, long n, long m) {
  		if (n == 0)
  			return 1;
  		long res = 1;
  		while (n > 0) {
  			if ((n & 1) != 0) {
  				res *= a;
  			}
  			a *= a;
  			n >>= 1;
  		}
  		return res;
  	}
  
  //-------------------------------------------------------------------------------------------
  
  	// gcd
  	static long gcd(long a, long b) {
  		return b == 0 ? a : gcd(b, a % b);
  	}
  
  //------------------------------------------------------------------------------------------
  
  	// lcm
  	static long lcm(long a, long b) {
  		return a / gcd(a, b) * b;
  	}
  
  //------------------------------------------------------------------------------------------
  	// BRIAN KERNINGHAM TO CHECK NUMBER OF SET BITS
  	// O(LOGn)
  	static int setBits(int n) {
  		int count = 0;
  		while (n > 0) {
  			n = n & (n - 1);
  			count++;
  		}
  		return count;
  	}
  //------------------------------------------------------------------------------------------
  
  //------------------------------------------------------------------------------------------
  	// 0 based indexing
  	static boolean KthBitSet(int n, int k) {
  		int mask = 1;
  		mask = mask <<= k;
  		if ((mask & n) != 0)
  			return true;
  		else
  			return false;
  	}
  
  //------------------------------------------------------------------------------------------
  
  	// EXTENDED EUCLIDEAN THEOREM
  	// TO REPRESENT GCD IN TERMS OF A AND B
  	// gcd(a,b) = a.x + b.y where x and y are integers
  
  	static long x = -1;
  	static long y = -1;
  
  	static long gcdxy(long a, long b) {
  		if (b == 0) {
  			x = 1;
  			y = 0;
  			return a;
  		} else {
  			long d = gcdxy(b, a % b);
  			long x1 = y;
  			long y1 = x - (a / b) * y;
  			x = x1;
  			y = y1;
  
  			return d;
  		}
  	}
  
  //-------------------------------------------------------------------------------------------------F
  }
  