Problems on these two questions
Ian Kelly
ian.g.kelly at gmail.com
Tue Nov 20 01:32:37 EST 2012
On Mon, Nov 19, 2012 at 4:15 PM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Sun, 18 Nov 2012 17:52:35 -0800 (PST), su29090 <129km09 at 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.
More information about the Python-list
mailing list