Python function to find all integers between two numbers whose sum of squared divisors is a perfect square
There is no need to go up to the number to know its factor, going up to the sqrt is enough:

def D(x):
    return sum(i**2 + int(((x / i) ** 2 if i * i != x else 0))  for i in range(1, floor(x ** 0.5) + 1) if not x%i)


That should speed up quite a bit the computation if you are dealing with big numbers