Python3, BruteForce OneLine
\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        return sum(nums[i]==nums[j] and (i*j)%k==0 for i in range(len(nums)) for j
```\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        return sum(nums[i]==nums[j] and (i*j)%k==0 for i in range(len(nums)) for j in range(i+1,len(nums)))\n```\nWe are taking all possible pairs from array and checking if they are good.\nExplanation in Python:\n```\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        n=len(nums)\n        answ=0\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:\n                    answ+=1\n        return answ\n```
[]