Python3 Solution With Prefix Sum
\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        \n        num_max = max(nums) + 1\n        counter = [0]*(num_max)\n       
```\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        \n        num_max = max(nums) + 1\n        counter = [0]*(num_max)\n        \n        for n in nums:\n            counter[n] += 1\n        \n        counter_prefix = [0] * (num_max)\n        counter_prefix[0] = counter[0]\n         # get prefix sum for each number\n\n        for i in range(1, len(counter)):\n            counter_prefix[i] = counter_prefix[i - 1] + counter[i]\n        result = 0\n        for i in range(1, num_max):\n\t\t\t# iterate through numbers in array\n            if counter[i] == 0:\n                continue\n            t = 1\n\t\t\t# count all numbers in the array, where y/i == t, range is [i * t inclusive, i * (t + 1) exclusive]\n            while i * t < num_max:\n                left = i * t - 1\n                right = i * (t + 1) - 1\n                if right >= num_max:\n                    right = num_max - 1\n                # count of all "y"\n                count = counter_prefix[right] - counter_prefix[left]\n                result = result + count * counter[i] * t\n                \n                t += 1\n                            \n            \n        return result % (10**9 + 7)\n```
['Python']