[Tutor] making lists of prime numbers

Alan Gauld alan.gauld at btinternet.com
Thu Sep 15 10:36:11 CEST 2011


On 15/09/11 03:01, c smith wrote:

> am I passing arguments from the command line correctly?

Yes, although not converting to an int.

> this seems to count by twos (going through both 'if statements' maybe?)
> I thought the 'break' would send control back to the 'while'
> basically, is there an obvious problem here or is it just completely wrong?

It might work once you iron out the bugs but it's horribly inefficient. 
It will take a very long time to run for large numbers. Did you try 
searching for prime number algorithms? There are several that will be 
much faster than this.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list