Will McGugan wrote:

> Some trivial optimizations. Give this a whirl.


I retimed and got 9.7 average for 3 runs on my version.

Yours got it down to 9.2.

5% improvement. Not bad.

(Inserting '2' at the beginning doesn't seem to impact performance
much.;-) )

BTW, strictly speaking, shouldn't I be adding something to the floating
point sqrt result, before converting to int, to allow for rounding
error?  If it is supposed to be 367 but comes in at 366.99999999, don't
I potentially classify a composite as a prime?

How much needs to be added?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to