Python | Simple algorithm similar to prime number generators
\n\n\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        freq = Counter(nums)\n        maxVal = max(nums)\n        cache = [0 fo
```\n\n\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        freq = Counter(nums)\n        maxVal = max(nums)\n        cache = [0 for i in range(maxVal + 1)]\n        for key in freq:\n            num = freq[key]\n            count = 1\n            while count*key <= maxVal:\n                cache[count*key] += num\n                count += 1\n        \n        count = 0\n        result = 0\n        for i in range(len(cache)):\n            count += cache[i]\n            if i in freq:\n                result += freq[i] * count\n        \n        return result % (10**9 + 7)\n```
['Python']