GCD || Keep Count of Prime Factors of k || C++
For each element in nums find out that, what should be multiplied with this elemet to make it divisble by k, that is given by "rem=k/gcd(k,nums[i])". \nNow chek
For each element in nums find out that, what should be multiplied with this elemet to make it divisble by k, that is given by "rem=k/gcd(k,nums[i])". \nNow chek in map that how many time rem has been found in past, and update ans.\nAlso each time find out the prime factors of nums[i] and update it\'s count in map\n```\nclass Solution {\npublic:\n    #define ll long long\n    ll coutPairs(vector<int> &a, int k){\n      ll ans=0;\n     unordered_map<ll,ll>mp;\n     for(int x:a)\n     {\n         int rem=(k/ __gcd(x,k));\n         ans+=mp[rem];\n         for(int i=1;i*i<=x;i++)\n         {\n             if(x%i==0)\n             {\n                 mp[i]++;\n                 if(i*i !=x)\n                 {\n                     mp[x/i]++;\n                 }\n             }\n         }\n      }\n     return ans;\n }\n};\n```
[]