Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
OP solved it, closing
Thanks for the info. Calculating the sum with prime factors helped a lot!
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.
This comment is hidden because it contains spoiler information about the solution
Could you update this in your description as well. All the numbers should be rounded of 2.
great!