On Sat, 6 Sep 2014 12:53:16 +0200, Manolo Martínez wrote:
On 09/06/14 at 08:38pm, Steven D'Aprano wrote:
But even that's not how the specialists do it. If you want to check whether
(say) 2**3000+1 is prime, you don't want to use trial division at all...
When I was interested in these things,
On 09/07/14 at 06:53pm, Peter Pearson wrote:
On Sat, 6 Sep 2014 12:53:16 +0200, Manolo Martínez wrote:
On 09/06/14 at 08:38pm, Steven D'Aprano wrote:
But even that's not how the specialists do it. If you want to check whether
(say) 2**3000+1 is prime, you don't want to use trial division at
On Sun, Sep 7, 2014 at 11:53 AM, Peter Pearson
pkpearson@nowhere.invalid wrote:
On Sat, 6 Sep 2014 12:53:16 +0200, Manolo Martínez wrote:
On 09/06/14 at 08:38pm, Steven D'Aprano wrote:
But even that's not how the specialists do it. If you want to check whether
(say) 2**3000+1 is prime, you
This is top posted and makes it extremely difficult to follow long
threads with many replies. This is heavily frowned upon here.
On 06/09/2014 02:54, Juan Christian wrote:
@Mark Lawrence: Sorry to ask, but what do you mean by don't top post
here, thanks., I'm not familiar with mailing lists,
On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head wrote:
But, what this instructions want printed is This is a prime number
So how to I use this code logic NOT print (not prime) and have the logic
print This number is prime
This is an algorithmic question, not a python question, so the answer
Denis McMahon wrote:
Note also that when searching for factors of a number n, and starting at
2, you can generally stop at somewhere around n/3,
The largest factor of N you actually need to check is sqrt(n). Every factor
of n below the square root has a corresponding factor above it, e.g. if
On Sat, Sep 6, 2014 at 8:38 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
3, 5, 7, 9 is a waste of time, 11, 13, 15 is a waste of time, ...
I love this sequence.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 09/06/14 at 08:38pm, Steven D'Aprano wrote:
But even that's not how the specialists do it. If you want to check whether
(say) 2**3000+1 is prime, you don't want to use trial division at all...
When I was interested in these things, specialists would use the [number
field
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a hard problem, but it got me to thinking a little. A
prime number will divide by one and
On 2014-09-05 17:48, Seymore4Head wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a hard problem, but it got me to thinking a
Bob gailer
On Sep 5, 2014 12:51 PM, Seymore4Head Seymore4Head@hotmail.invalid
wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a
On 09/05/2014 09:48 AM, Seymore4Head wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a hard problem, but it got me to thinking a
On Fri, Sep 5, 2014 at 9:48 AM, Seymore4Head Seymore4Head@hotmail.invalid
wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a hard
In 1enj0att6bkrnvb81rhma5dbuk3h28a...@4ax.com Seymore4Head
Seymore4Head@Hotmail.invalid writes:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
On Fri, Sep 5, 2014 at 11:08 AM, Ethan Furman et...@stoneleaf.us wrote:
Python's 'for' loop has a handy 'else' extension which is perfect for the
search-type of 'for' loop:
while True:
a=random.randrange(1,8)
print (a)
for x in range(2,a):
if a%x==0:
I made this code just for fun and learning, it's working, but would this be
a good approach? Thanks.
import sys
def prime_checker(start = 1, stop = 1):
for number in range(start, stop + 1):
divisors = [(number % x) for x in range(1, number + 1)]
print({n} prime? {r}.format(n = number, r =
On Fri, 05 Sep 2014 10:08:18 -0700, Ethan Furman et...@stoneleaf.us
wrote:
On 09/05/2014 09:48 AM, Seymore4Head wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
On Fri, Sep 5, 2014 at 10:44 AM, Seymore4Head Seymore4Head@hotmail.invalid
wrote:
On Fri, 05 Sep 2014 10:08:18 -0700, Ethan Furman et...@stoneleaf.us
wrote:
On 09/05/2014 09:48 AM, Seymore4Head wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books
On 09/05/2014 10:17 AM, Ian Kelly wrote:
I would not worry about the else clause as a beginner, as it's
relatively unique to Python and tends to be somewhat confusing. Use a
flag or refactor the function instead.
I don't disagree with this, but early exposure to for..else is for search loops
On 2014-09-05 18:35, Juan Christian wrote:
I made this code just for fun and learning, it's working, but would this
be a good approach? Thanks.
import sys
def prime_checker(start = 1, stop = 1):
In Python, the standard is to use a half-open range.
for number in range(start, stop + 1):
What's [snip] ??
On Fri, Sep 5, 2014 at 3:48 PM, MRAB pyt...@mrabarnett.plus.com wrote:
On 2014-09-05 18:35, Juan Christian wrote:
I made this code just for fun and learning, it's working, but would this
be a good approach? Thanks.
import sys
def prime_checker(start = 1, stop = 1):
On 05/09/2014 20:34, Juan Christian wrote:
What's [snip] ??
As in cut out or chopped out such that some of the original text has
been removed. And please don't top post here, thanks.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Juan Christian juan0christ...@gmail.com writes:
I made this code just for fun and learning, it's working, but would
this be a good approach? Thanks. ...
** ** for number in range(start, stop + 1):
** ** ** ** divisors = [(number % x) for x in range(1, number + 1)]
** ** ** ** ** **
On Fri, Sep 5, 2014 at 11:44 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
BTW since I am getting no grade, I much prefer the answer than a hint.
The best hint IMO is to tell me how you would do it.
from math import ceil, sqrt
def is_prime(n):
if n 2:
return False
if n
On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a hard
On Fri, Sep 5, 2014 at 2:49 PM, Seymore4Head Seymore4Head@hotmail.invalid
wrote:
On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
On Fri, Sep 5, 2014 at 3:49 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
I am sure this has already been done, but after it was pointed out
that you don't need to test for any number that multiplies by 2 it
made me think again.
If you start with the list [3,5,7] and step through the
On Fri, 5 Sep 2014 15:14:41 -0700, Chris Kaynor
ckay...@zindagigames.com wrote:
On Fri, Sep 5, 2014 at 2:49 PM, Seymore4Head Seymore4Head@hotmail.invalid
wrote:
On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:
I'm still doing practice problems. I haven't
On Fri, 5 Sep 2014 16:35:18 -0600, Ian Kelly ian.g.ke...@gmail.com
wrote:
On Fri, Sep 5, 2014 at 3:49 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
I am sure this has already been done, but after it was pointed out
that you don't need to test for any number that multiplies by 2 it
made
On Sat, Sep 6, 2014 at 3:44 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
BTW since I am getting no grade, I much prefer the answer than a hint.
The best hint IMO is to tell me how you would do it.
But for your own learning, it's still better for you to do things
yourself. Giving you the
On Saturday, September 6, 2014 1:37:57 AM UTC+5:30, Paul Rubin wrote:
Juan Christian writes:
I made this code just for fun and learning, it's working, but would
this be a good approach? Thanks. ...
** ** for number in range(start, stop + 1):
** ** ** ** divisors = [(number % x) for x
@Mark Lawrence: Sorry to ask, but what do you mean by don't top post here,
thanks., I'm not familiar with mailing lists, so I may be doing something
wrong and I don't know.
On Fri, Sep 5, 2014 at 4:54 PM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 05/09/2014 20:34, Juan Christian wrote:
On Saturday, September 6, 2014 7:25:10 AM UTC+5:30, Juan Christian wrote:
@Mark Lawrence: Sorry to ask, but what do you mean by don't top post here,
thanks., I'm not familiar with mailing lists, so I may be doing something
wrong and I don't know.
Maybe better to say use this
Juan Christian juan0christ...@gmail.com writes:
@Mark Lawrence: Sorry to ask, but what do you mean by don't top post
here, thanks., I'm not familiar with mailing lists, so I may be doing
something wrong and I don't know.
Please post your responses interleaved with the quoted material to
which
On Fri, Sep 5, 2014 at 11:37 PM, Ben Finney ben+pyt...@benfinney.id.au
wrote:
Juan Christian juan0christ...@gmail.com writes:
@Mark Lawrence: Sorry to ask, but what do you mean by don't top post
here, thanks., I'm not familiar with mailing lists, so I may be doing
something wrong and I
Seymore4Head Seymore4Head@Hotmail.invalid Wrote in message:
On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:
If you start with the list [3,5,7] and step through the list of all
remaining odd numbers (step 2), and start appending numbers that won't
On Fri, Sep 5, 2014 at 10:06 PM, Juan Christian
juan0christ...@gmail.com wrote:
On Fri, Sep 5, 2014 at 11:37 PM, Ben Finney ben+pyt...@benfinney.id.au
wrote:
Juan Christian juan0christ...@gmail.com writes:
@Mark Lawrence: Sorry to ask, but what do you mean by don't top post
here, thanks.,
37 matches
Mail list logo