On Mon, Nov 19, 2012 at 4:15 PM, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Sun, 18 Nov 2012 17:52:35 -0800 (PST), su29090 <129k...@gmail.com> > declaimed the following in gmane.comp.python.general: > >> >> I all of the other problems but I have issues with these: >> >> 1.Given a positive integer n , assign True to is_prime if n has no >> factors other than 1 and itself. (Remember, m is a factor of n if m >> divides n evenly.) >> > Google: Sieve of Eratosthenes (might be mis-spelled)
No, the Sieve is nifty, but it's meant for generating sequences of primes, not for testing individual primality. It's also more complex than is necessary. A better starting place for a programming novice is with trial division, which is a somewhat simpler algorithm and all that is needed here. -- http://mail.python.org/mailman/listinfo/python-list