// Arup Guha
// 8/31/2016
// Solution to 2016 UCF Locals Problem: Count the Dividing Pairs

import java.util.*;

public class divide {

	final public static int LIMIT = 10000000;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Go through each case.
		for (int loop=1; loop<=numCases; loop++) {

			// Read in the data into a frequency array, since input values
			// are limited to 10^7. Also keep track of actual max.
			long[] freq = new long[LIMIT+1];
			int n = stdin.nextInt();
			int max = 0;
			for (int i=0; i<n; i++) {
				int item = stdin.nextInt();
				freq[item]++;
				max = Math.max(max, item);
			}

			long res = 0;

			// Do a modified prime sieve! i is the proper divisor, j is the number
			// it divides into...must use long for 500000 * 500000.
			for (int i=1; i<=max/2; i++) {

				// Skip terms destined to be 0.
				if (freq[i] == 0) continue;

				// Count everything that matches all copies of i here.
				long matches = 0;
				for (int j=2*i; j<=max; j+=i)
					matches += freq[j];
				res += freq[i]*matches;
			}

			// Zero is annoying, just add it in at the end.
			res += freq[0]*(n-freq[0]);

			// Ta da!
			System.out.println("Test case #"+loop+": "+res+"\n");
		}
	}
}