You are given an array $$$a$$$ of length $$$n$$$ consisting of positive integers. You have to process $$$q$$$ queries of two types:
All indices are $$$1$$$-based.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \le t \le 10^{3})$$$. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n \le 10^{5};\ 1 \le q \le 10^{5})$$$. The second line contains $$$n$$$ integers $$$a_1,\dots,a_n$$$ $$$(1 \le a_i \le 10^{6})$$$. Each of the next $$$q$$$ lines is one of:
For each query of type 1, print a single integer — the number of indices $$$j$$$ ($$$j \ne i$$$) such that $$$\gcd(a_i,a_j)=g$$$. Print each answer on a separate line.
24 212 8 9 181 1 121 4 25 101 1 2 3 61 1 11 5 22 2 12 3 11 5 31 4 62 1 61 1 62 1 61 2 1
01411014
In the first test case, for the first query we need to find elements in the array that satisfy $$$ \gcd(a_i, 12) = 12 \, \forall \, i \neq 1$$$. No such numbers exist in the array so the answer is 0. For the second query we need to find elements such that $$$ \gcd(a_i, 18) = 2 \, \forall \, i \neq 4$$$
In the second test case, for the first query all the numbers in the given array satisfy $$$ \gcd(a_i, 1) = 1$$$, so the answer is 4. For the second query, only $$$a_3 = 2$$$ satisfies $$$ \gcd (6, a_i) = 2$$$. After the third query, the array remains unchanged and after the fourth query it becomes $$$ [1,1,1,3,6] $$$. For the fifth query, only one element $$$ a_4 = 3 $$$ satisfies $$$ \gcd(6, a_j)=3 $$$