Python Prime Search Slower Optimization
The difference averages to .2 microseconds per number checked.
To see if its the inner loop, try unrolling it in the second program:
...
for i in range(5, ceiling+1, 6):
    # test only against factors less than the square root
    # just use the sqrt of the bigger number to avoid another call to sqrt
    root = math.sqrt(i + 2)

    # tests 6k - 1
    for j in prime:
        if j &gt; root:
            prime.append(i)
            break
        if i % j == 0:
            break

    # tests 6k + 1
    i += 2
    for j in prime:
        if j &gt; root:
            prime.append(i)
            break
        if i % j == 0:
            break
    ...