Ask
your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW)
5 Online
Fastest of Fastest Algorithm to calculate 10000 primes in python ?is it
Still Need Help?
Join the QuestionCove community and study together with friends!
import time from math import sqrt st=time.time() mdu=0 check =3 noofprime=2 primeLs=[2,3] prime=True while noofprime!=10000: check=check+2 if check%3==0:check=check+2 sqrcheck=int (sqrt(check))+1 for div in range (3,sqrcheck): prime=True mdu=check%div if mdu==0 : prime=False break if prime==True: noofprime= noofprime+1 primeLs=primeLs+[check] et=time.time() print primeLs[noofprime-1] print st print et print (et-st)/60
i get this time when checked without writing to list prime 104729 st:1298174950.11 et:1298174952.94 0.0471333344777
Can't find your answer?
Make a FREE account and ask your own questions, OR help others and earn volunteer hours!
Join our real-time social learning platform and learn together with your friends!
Join our real-time social learning platform and learn together with your friends!
Latest Questions
Countless7Echos:
I don't know just no sketch doodle day :p finished a video already so I'm pretty
Ferrari:
Depression Hi, it's me, Jordan (ferrari). It's supposed to be the Fourth of July but I feel kinda depressed and mad at myself for no reason.
Countless7Echos:
mmm I forgot to post but hey first time trying out hyperpop art :3 super fun TW:
RAVEN69:
The hole You can't fix the hole in my heart. It's permanent. It's been broken to many times and I love it every time.
6 hours ago
9 Replies
2 Medals
7 hours ago
12 Replies
1 Medal
1 day ago
9 Replies
5 Medals
2 days ago
0 Replies
0 Medals