Re: [Tutor] Writing a prime number program using upper bound of square root of n

2010-08-22 Thread Steven D'Aprano
On Mon, 23 Aug 2010 07:48:03 am Denis Gomes wrote: > Nick, > >If you are using python 2.X, xrange(2,n) is just like range(2,n), > the xrange function is faster. In python 3.X, they got rid of the > slower range function and renamed xrange to range. A slight over-simplification, but broadly co

Re: [Tutor] Writing a prime number program using upper bound of square root of n

2010-08-22 Thread Steven D'Aprano
On Mon, 23 Aug 2010 04:55:15 am Nick wrote: > Is there a way I can set my email program to insert the ">" symbol to > mark what I'm replying to without manually doing it? Depends on your mail client. What are you using? Outlook? > I get the picture now, that was a great example. I wrote some

Re: [Tutor] Writing a prime number program using upper bound of square root of n

2010-08-22 Thread Denis Gomes
PM > *To:* Nick > *Subject:* Re: [Tutor] Writing a prime number program using upper bound of > square root of n > > Hey Nick, > >You can also try using list comprehensions to do the same thing. You > could do something as follows: > > def p(n): > return [2,

Re: [Tutor] Writing a prime number program using upper bound of square root of n

2010-08-22 Thread Alan Gauld
"Nick" wrote Is there a way I can set my email program to insert the ">" symbol to mark what I'm replying to without manually doing it? Give us a clue. What is your email program? You can do it in most programs but the method will be different in each! HTH, -- Alan Gauld Author of the

Re: [Tutor] Writing a prime number program using upper bound of square root of n

2010-08-22 Thread Nick
"1 * 120 = 120 2 * 60 = 120 3 * 40 = 120 4 * 30 = 120 5 * 24 = 120 6 * 20 = 120 8 * 15 = 120 10 * 12 = 120 10.9545 * 10.9545 = 120 12 * 10 = 120 <=== already seen this one! > Also I can write a program that > tests whether the number is a factor of 2, 3, 5, 7, but I think > you're trying to poin