Strange results for the time that a program takes to run
<p>Here is a program that I wrote in Python:</p>

<pre><code>import sys
from time import time
start = time()

x = input('How many primes? ')
if x &lt; 1:
        sys.exit("invalid input")
y = 3
primes = [2]

while len(primes) &lt; x:

        for i in primes:

                if y % i == 0:
                        break
            elif i &gt; (y**(.5)):
                    primes.append(y)
                    break

    y += 1

print primes
print time() - start
</code></pre>

<p>It works well, but I have noticed something strange. If I ask for 1000 primes, the program takes about 2.3 seconds to find an answer, but if I ask for 10000 primes, the program takes about 1.8 seconds to find an answer. This doesn't make much sense because the program has to do more calculations to find 10000 primes than 1000. Can anyone explain what is causing this?</p>
