Simplest solution beat 80%
\n# Code\n\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        count = 0\n        for i in range(len(nums)):\n            for j
\n# Code\n```\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        count = 0\n        for i in range(len(nums)):\n            for j in range(i+1,len(nums)):\n                if nums[i] == nums[j] and (i * j) % k == 0:\n                    count += 1\n                        \n        return count\n        \n```
['Python3']