a better prime number generator

Peter Hansen peter at engcorp.com
Mon Oct 22 01:29:49 CEST 2001


Moshe wrote:
> I think the OP would be best suited using this algorithm with a faster
> language. I'm not really sure what in python is fast and what is not, but
> for a goal this simple, why not just write a python module in C, or just a
> C program?

I think the OP was more interested in using this as a learning
exercise.  As he said [typos edited by me]:

"""
  hi all,
  I have just been introduced to python and find it a very good ( takes
  off all the bookwork ) language. I was trying to develope a fast prime
  number generator. I designed the following algo. Can you please
  suggest a faster one or modifications to this only to make it faster?
"""

Sounds to me like he was more interested in learning how to write
fast Python code than in getting a program to run the algorithm as
fast as possible, regardless of language.

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list