Program exceeded run time limit while finding factors of a very large number in python
<p>I am trying to do a problem to find the factors of a number. THe number is very very large. </p>

<p>The code that I am using is as follows:</p>

<pre><code>def factors(n):
    result = []

    for i in range(1, n + 1):
        if n % i == 0:
            result.append(i)

    return result

print factors(5000000)
</code></pre>

<p>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. </p>
