I am trying to do a problem to find the factors of a number. THe number is very very large.
The code that I am using is as follows:
def factors(n):
result = []
for i in range(1, n + 1):
if n % i == 0:
result.append(i)
return result
print factors(5000000)
If I change the number to smaller number the program runs good, but when I increase the number, it throws an error. Is there any way to fix this ? Thanks.