Everything in Excess!

From programming_contest
Jump to navigation Jump to search

Factor all the numbers in the range using the linear time algorithm. For each number in the range, walk through the factors and calculate the excess.

Runtime: Factoring all numbers O(n), calculating excess for a given number having pre-computed the factors O(log(n))