Ad
  • Custom User Avatar

    OP solved it, closing

  • Default User Avatar

    Thanks for the info. Calculating the sum with prime factors helped a lot!

  • Default User Avatar

    Think further about this line in get_divisor_sum(x):

    for i in range (2, int(x/2) + 1):

    You can do some further optimization on the upper end of the range as you don't need to count up to half of x if you use a common trick when calculating divisors. If x % i == 0, i is a divisor, but so is x // i, which you basically get for free here.

    That being said, for very large numbers this solution might still time out. A more efficient way is to calculate the sum of the divisors through the prime factors and their exponents - both of which can be calculated very efficiently.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Could you update this in your description as well. All the numbers should be rounded of 2.

  • Default User Avatar