Python | O(N * (k^1/3)) | Easy code with explanation (Get all factors)
Explanation:\n1. We can get all factors of k first.\n2. For each num  in nums, k // gcd(num, k) will be the multiplier that num needs that make the result is di
## Explanation:\n1. We can get all factors of `k` first.\n2. For each `num`  in `nums`, `k // gcd(num, k)` will be the multiplier that num needs that make the result is divisible by `k`.\n3. We use `counter` to maintain how many numbers is divisible by factors of `k`.\n\n\n## Solutions:\n```\nclass Solution:\n    def coutPairs(self, nums: List[int], k: int) -> int:\n        # Generate all factors of k\n        factors = []\n        for i in range(1, int(k ** 0.5) + 1):\n            if k % i == 0:\n                factors.append(i)\n\t\t\t\t# To prevent us from putting the same number into it\n                if k // i != i:\n                    factors.append(k // i)\n        \n        res = 0\n        counter = collections.Counter()\n        for num in nums:\n            # `k // math.gcd(num, k)` is the smallest factor that makes `num` multiply it will be divisible by k\n            res += counter[k // math.gcd(num, k)]\n            \n            for factor in factors:\n                # if num % factor == 0, means if can provide this factor for other `num` to multiply and make it divisible by k\n                if num % factor == 0:\n                    counter[factor] += 1\n        return res\n```\n\n## Complexcity\nTime Complexity: O(N * (k^1/3)) //  N = len(nums)\nSpace Complexity: O(k^1/3)\n
['Python', 'Python3']