[Tutor] Optimisation of prime number program (cont. from finding prime numbers)

Kent Johnson kent37 at tds.net
Wed Sep 26 12:49:42 CEST 2007


Kalle Svensson wrote:
> After quite a bit of experimentation, I finally managed to write a
> program that was accepted by the judge system. It's a C++
> implementation of the deterministic Miller-Rabin algorithm. My Python
> implementation of the same algorithm is still too slow, though. Has
> anyone managed to write a fast enough Python program?

Have you tried using psyco?
Have you seen this thread? It has some very interesting ideas about 
speeding up the sieve algorithm. (Uncle Timmy is Tim Peters who still 
has one of the fastest Python solutions.)
https://www.spoj.pl/forum/viewtopic.php?t=3226

Kent


More information about the Tutor mailing list