Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where 0 <= i < j < n, such that nums[i] == nums[j] and (i * j) is divisible by k.
 
Please complete the following python code precisely:
```python
class Solution:
    def countPairs(self, nums: List[int], k: int) -> int:
```