Simple Python Solution
Time complexcity O(N^2)\nSpace Complexcity O(1)\n\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        count=0\n        #nums.so
Time complexcity O(N^2)\nSpace Complexcity O(1)\n```\nclass Solution:\n    def countPairs(self, nums: List[int], k: int) -> int:\n        count=0\n        #nums.sort()\n        n=len(nums)\n        for i in range(n-1):\n            for j in range(i+1,n):\n                if nums[i]==nums[j] and (i*j)%k==0:\n                    count+=1\n        return count\n\n```
['Python3']