C++ Binary Search + Sieve Approach
\n\n\nint sumOfFlooredPairs(vector<int>& nums) {\n        long long ans = 0;\n        long long mod = 1000000007;\n        \n        sort(nums.begin(),nums.end(
\n\n```\nint sumOfFlooredPairs(vector<int>& nums) {\n        long long ans = 0;\n        long long mod = 1000000007;\n        \n        sort(nums.begin(),nums.end());\n        \n        int n = nums.size();\n        long long curans = 0;\n        for(int i = 0 ; i < n; ++i){\n            int prev = i;\n            int jump = 2;\n            if(i > 0 and nums[i] == nums[i-1]) { // If similar value add precomputed value.\n                ans += curans;\n                continue;\n            }\n            curans = 0;\n            while(true){\n                auto cur = lower_bound(nums.begin(),nums.end(),nums[i]*jump) - nums.begin(); \n                \n                curans =( curans + ((cur-prev)%mod)*((jump-1)%mod))%mod;\n                prev = cur;\n                jump++;\n                if(cur == n) break;\n            }\n            ans = (ans + curans)%mod;\n        }\n        return (int) ans;\n    }\n```
['Binary Search']