Oct-20-2020, 04:42 AM
There are so few numbers that brute force is still pretty efficient. Since you cannot iterate with floats I just multiply everything times 10 and test every number from 1 (0.1x10) to 100 (10x10) to see if it is a factor of 100.
factors = [x/10 for x in range(1, 101) if (100 / x) % 1 == 0] print(factors)For a larger range you can speed thing up by only testing numbers from 0.1 to the square root of the value and using these to compute the "upper" factors.