C# version that minimizes the number of iterations in loops.
Intuition\nInitial thought was nested loops, however that was inefficient.\n\n# Approach\nCreate an array that contains the frequency, or count, of each number 
# Intuition\nInitial thought was nested loops, however that was inefficient.\n\n# Approach\nCreate an array that contains the frequency, or count, of each number in the given array.  Create a second array that contains the prepared summation counts.\n\nLooping through the frequency map, determine the count by taking the upper summation count minus the lower summation count.  Multiply that count number by the loop counter and the frequency count.\n\n# Code\n```\nclass Solution {\n\n    private const int Mod = 1000000007;\n    private const int MaxNumber = 100000;\n\n    public int SumOfFlooredPairs(int[] nums)\n    {\n        var total = 0L;\n        var min = nums.Min();\n        var max = Math.Min(MaxNumber, nums.Max());\n        var frequencies = new int[max + 1];\n        var preparedSummations = new long[max + 2];\n    \n        foreach (var num in nums)\n        {\n            ++frequencies[num];\n        }\n    \n        for (var i = min; i < frequencies.Length; i++)\n        {\n            preparedSummations[i + 1] = preparedSummations[i] + frequencies[i];\n        }\n    \n        for (var i = min; i < frequencies.Length; i++)\n        {\n            if (frequencies[i] == 0)\n            {\n                continue;\n            }\n    \n            for (var j = 1; j * i <= frequencies.Length; j++)\n            {\n                var lower = i * j;\n                var upper = i * (j + 1) - 1;\n                var count = preparedSummations[Math.Min(upper + 1, frequencies.Length)] - preparedSummations[Math.Min(lower, frequencies.Length)];\n                total += count * j * frequencies[i];\n            }\n        }\n    \n        return (int)(total % Mod);\n    }\n}\n```
['C#']