Python Simple Solution in 5 Lines
\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        c,n=0,len(nums)\n        for i in range(n):\n            for j in range(i+
```\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        c,n=0,len(nums)\n        for i in range(n):\n            for j in range(i+1,n):\n                if nums[i]==nums[j] and (i*j)%k==0: c+=1\n        return c\n ```
['Python']