Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33588

Re: Problems on these two questions

References <400c615f-4d93-4b8b-85ec-1bb4c47e30fe@googlegroups.com> <s4fla8haeilkb4p0ihqb6kh1amn22v4vad@invalid.netcom.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-11-19 23:32 -0700
Subject Re: Problems on these two questions
Newsgroups comp.lang.python
Message-ID <mailman.31.1353393197.29569.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Nov 19, 2012 at 4:15 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Sun, 18 Nov 2012 17:52:35 -0800 (PST), su29090 <129km09@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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Problems on these two questions su29090 <129km09@gmail.com> - 2012-11-18 17:52 -0800
  Re: Problems on these two questions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-19 02:09 +0000
  Re: Problems on these two questions su29090 <129km09@gmail.com> - 2012-11-18 18:15 -0800
    Re: Problems on these two questions Dave Angel <d@davea.name> - 2012-11-18 21:33 -0500
  Re: Problems on these two questions Dave Angel <d@davea.name> - 2012-11-18 21:18 -0500
  Re: Problems on these two questions Chris Angelico <rosuav@gmail.com> - 2012-11-19 13:23 +1100
  Re: Problems on these two questions Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-19 18:15 -0500
    Re: Problems on these two questions Neil Cerutti <neilc@norwich.edu> - 2012-11-20 15:02 +0000
  Re: Problems on these two questions Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-19 18:16 -0500
  Re: Problems on these two questions Dave Angel <d@davea.name> - 2012-11-19 20:52 -0500
  Re: Problems on these two questions Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-19 23:32 -0700

csiph-web