[Tutor] prime test problem

Evert Rol evert.rol at gmail.com
Sat Aug 21 17:11:53 CEST 2010


> Hello, 
>  
> I know.
> I have read them all I believe but I can't see how I can convert the algebra to a working programm.

And if you just search Google for "Python prime number algorithm"? Perhaps it's cheating, so you'll have to try and fully understand the code first before you run it (be sure to read comments if there are any, eg the activatestate recipes; can have tons of useful extra info & links).
Generally, try to start with a program yourself, and then see where you get stuck. You could then post your stuck algorithm to the list and ask for advice; your current question is a bit too general, and thus harder to answer.

  Evert


>  
> Roelof
> 
>  
> Date: Sat, 21 Aug 2010 19:15:03 +0530
> Subject: Re: [Tutor] prime test problem
> From: nitin.162 at gmail.com
> To: rwobben at hotmail.com
> CC: tutor at python.org
> 
> For this problem u will get lots of solutions on the net.
> e.g wilson's theorem , sieve of eranthoses etc.
> 
> --nitin
> 
> On Sat, Aug 21, 2010 at 7:05 PM, Roelof Wobben <rwobben at hotmail.com> wrote:
> Hello, 
>  
> I have to make a programm which can test if a number is a prime.
> I know a prime is a number which can only be diveded by 1 and itself.
>  
> One way is was thinking about is to make a loop which try if % has output 0.
> But that don't work.
>  
> Can someone give me a hint what's the best approach is.
>  
> Roelof
>  


More information about the Tutor mailing list