You are given a rectangular parallelepiped with sides of positive integer lengths AA, BB and CC.
Find the number of different groups of three integers (aa, bb, cc) such that 1≤a≤b≤c1≤a≤b≤c and parallelepiped A×B×CA×B×C can be paved with parallelepipeds a×b×ca×b×c. Note, that all small parallelepipeds have to be rotated in the same direction.
For example, parallelepiped 1×5×61×5×6 can be divided into parallelepipeds 1×3×51×3×5, but can not be divided into parallelepipeds 1×2×31×2×3.
The first line contains a single integer tt (1≤t≤1051≤t≤105) — the number of test cases.
Each of the next tt lines contains three integers AA, BB and CC (1≤A,B,C≤1051≤A,B,C≤105) — the sizes of the parallelepiped.
For each test case, print the number of different groups of three points that satisfy all given conditions.
4 1 1 1 1 6 1 2 2 2 100 100 100
1 4 4 165
In the first test case, rectangular parallelepiped (1,1,1)(1,1,1) can be only divided into rectangular parallelepiped with sizes (1,1,1)(1,1,1).
In the second test case, rectangular parallelepiped (1,6,1)(1,6,1) can be divided into rectangular parallelepipeds with sizes (1,1,1)(1,1,1), (1,1,2)(1,1,2), (1,1,3)(1,1,3) and (1,1,6)(1,1,6).
In the third test case, rectangular parallelepiped (2,2,2)(2,2,2) can be divided into rectangular parallelepipeds with sizes (1,1,1)(1,1,1), (1,1,2)(1,1,2), (1,2,2)(1,2,2) and (2,2,2)(2,2,2).
从所有的因数里,通过组合数学和容斥原理的方法,当然也可以求出正确的结果,但这是大佬的操作,不是我弱鸡小叮当的操作。但如果反过来,首先就把所有的因数都分好类,然后以类为基础做组合数,就简单多了。所有的类一共有7种,要么只属于A,要么只属于B,要么只属于C,要么只属于AB,要么只属于BC,等等。我们知道,几个数的公约数的个数,也是他们最大公约数的因数个数,这就很好算了。接下来我们枚举三个数的类别,当三个类别涵盖了a,b,c三个数的时候,我们就能用来枚举,反之就不行。然后我们枚举的时候在记录一下从每一类里面要取几个数出来。