JS Solution
\n# Code\n\nvar countPairs = function(nums, k) {\n    let count=0;\n    for(let i=0;i<nums.length;i++){\n        for(let j=i+1;j<nums.length;j++){\n            
\n# Code\n```\nvar countPairs = function(nums, k) {\n    let count=0;\n    for(let i=0;i<nums.length;i++){\n        for(let j=i+1;j<nums.length;j++){\n            if((nums[i]===nums[j])&&((i*j)%k)===0){\n                count++;\n            }\n        }\n    }\n    return count;\n};\n```
['JavaScript']