nlogn solution using maths
\n\n# Code\n\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n      n,ans = 2*max(nums) + 11,0\n      p,arr = [0 for _ in range(n)],[
\n\n# Code\n```\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n      n,ans = 2*max(nums) + 11,0\n      p,arr = [0 for _ in range(n)],[]\n      for i in nums:\n        p[i] += 1 \n        if p[i] == 1 : arr.append(i)\n      arr.sort()\n      for i in range(1,n): p[i] += p[i-1] \n      for x in arr : \n        i, j, curr = x, x, 0 \n        for i in range(x,n,x):\n          ans += (p[x] - p[x-1]) * (i//x -1) * (p[i-1]-p[j-1]) \n          ans, j = ans%1000000007, i\n      \n      return ans\n        \n```
['Python3']