Prime number testing
Rahul
codelykos at yahoo.com
Mon Jul 12 05:25:01 EDT 2004
Hi.
Thanks for all the info from all people.
Sorry for posting incorrect code.
Change some lines.
import math
(instead of importing sqrt from math)
and these two also
sqrt=math.sqrt(x)
sqrt=sqrt+1
Some clarifications :
> Looking at this and assuming that 2**61 -1 is prime, you find that
> this will do (2**61-1) or about 2**60 divisions. If you assume you
> can perform 10**9 divisions per sec, then this will take about 36
> years. That's why your function is slow.
I am diving upto square root.That is upto about 2**30 or around one
billion times.Assuming a modest speed of 0.1 million divisons per
second this should take 100000 secs or three hours.Though still slow.
I will look up knuth and also the links suggested.
Thanks for the illumination
Rahul
More information about the Python-list
mailing list