JavaScript DP
The idea:\nFor each number, we have x other numbers that are at least as large as it, then some subset that are 2x larger, 3x larger, etc until you go over MAX.
The idea:\nFor each number, we have ```x``` other numbers that are at least as large as it, then some subset that are 2x larger, 3x larger, etc until you go over MAX.\n- Any number that\'s between sizes of ```1 x n``` to ```1.99999... x n``` count once\n- numbers between ```2 x n``` to ```2.99999... x n``` count twice, etc.\n```\n    n * 4                        L M\n    n * 3                  I J K L M\nnum n * 2        D E F G H I J K L M\n    n * 1  A B C D E F G H I J K L M\n\t\t\t\tnums greater\n```\nSo we can build a table that shows how many numbers are >= any number up to the max of nums. Then, for each num, we\'ll multiply it by 1, 2, 3, etc until we get to max, and look up how many numbers fall into each range.\n\nAn edge case would be, what if we have 99,999 1s and 1 100,000. We can deal with that by using a frequency counter of each num instead of looking at literally every num, so our worst case scenario is if we have all the numbers in the range ```1...100,000```, which is a lot better than if we did ```99,999 x 100,000``` comparisons for all those ones.\n\nGiven the example nums ```[2, 5, 9]```, we get a table that looks like\n```\n[3, 3, 3, 2, 2, 2, 1, 1, 1, 1]\n```\nWe find:\n```\nnum: 2\n3 nums >= 2 * 1\n2 nums >= 2 * 2\n1 nums >= 2 * 3\n1 nums >= 2 * 4\n0 nums >= 2 * 5\n\nnum: 5\n2 nums >= 5 * 1\n0 nums >= 5 * 2\n\nnum: 9\n1 nums >= 9 * 1\n0 nums >= 9 * 2\n```\nSum the first column to get 10, and you\'re done.\n\n**The Code**\n\n```javascript\nvar sumOfFlooredPairs = function(nums) {\n  const MAX = Math.max(...nums);\n  \n  const countsGreaterOrEqualTo = new Array(MAX+1).fill(0);\n  \n  nums.forEach((num) => countsGreaterOrEqualTo[num] += 1 );\n  \n  for (let num = MAX - 1; num >= 0; num -= 1) {\n    countsGreaterOrEqualTo[num] += countsGreaterOrEqualTo[num + 1];\n  }\n\n  const numCounts = nums.reduce((counts, num) => {\n    counts.set(num, (counts.get(num) || 0) + 1);\n    return counts;\n  }, new Map())\n  \n  const MOD = 10 ** 9 + 7;\n  let totalCount = 0;\n\n  numCounts.forEach((count, num) => {\n    let current = num;\n    \n    while (current <= MAX) {\n      totalCount = (totalCount + countsGreaterOrEqualTo[current] * count) % MOD;\n      current += num;\n    }\n  });\n  \n  return totalCount;\n};\n```
['Dynamic Programming', 'JavaScript']