#K4751. Count Coprime Pairs
Count Coprime Pairs
Count Coprime Pairs
You are given several test cases. In each test case, you are given a collection of integers representing the magical power of gemstones. Your task is to count the number of unordered pairs \((i, j)\) such that \(0 \leq i < j < n\) and the greatest common divisor (gcd) of the two numbers is 1.
In mathematical terms, two numbers \(a\) and \(b\) are considered coprime if \(\gcd(a, b) = 1\). For each test case, print the total number of such coprime pairs.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer \(T\) representing the number of test cases.
- For each test case:
- The first line contains an integer \(n\), the number of gemstones.
- The second line contains \(n\) space-separated integers, each representing the magical power of a gemstone.
outputFormat
For each test case, output a single line to standard output (stdout) containing the number of coprime pairs found in that test case.
## sample1
3
2 3 4
2
</p>