isPrime is now Primo, part 2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

isPrime is now Primo, part 2

Chris Cunnington
Sigh. Premature send. 

My point is that isPrime in 3.10.2 would always give an error if sent to a 1.

1 isPrime 

produced an error. That was what I was seeing. Now, with a great, new Trunk isPrime, I can substitute and it works as expected. 

Sometimes it's not me. And the Trunk code rocks.

Chris 


Reply | Threaded
Open this post in threaded view
|

Re: isPrime is now Primo, part 2

espin
In fact 1 (integer one) is by definition NOT a prime number
and for the first prime numbers: http://primes.utm.edu/lists/small/1000.txt

Bye
Enrico

On Tue, Mar 9, 2010 at 11:36 PM, Chris Cunnington <[hidden email]> wrote:
Sigh. Premature send. 

My point is that isPrime in 3.10.2 would always give an error if sent to a 1.

1 isPrime 

produced an error. That was what I was seeing. Now, with a great, new Trunk isPrime, I can substitute and it works as expected. 

Sometimes it's not me. And the Trunk code rocks.

Chris 






--
Enrico Spinielli
"Do Androids dream of electric sheep?"— Philip K. Dick
"Hear and forget; see and remember;do and understand."—Mitchel Resnick


Reply | Threaded
Open this post in threaded view
|

Re: isPrime is now Primo, part 2

Chris Cunnington
In reply to this post by Chris Cunnington
"In fact 1 (integer one) is by definition NOT a prime number
see http://primes.utm.edu/"

Yea, I had a feeling somebody was going to say this. As a non-math person, it seems obvious to me that 1 would be a prime. That it is a prime doesn't change for me that the old design of isPrime in 3.10.2 was not to my liking. If I give isPrime a list of numbers to check. It should give a judgement on whether it is or isn't prime. It shouldn't say "I'll stop on 1, because.... it's not a prime!" 4 isn't a prime either. Should it stop there? Clearly the designers of the new Trunk isPrime didn't think so. The old implementation created confusion for me, where, rightfully, I don't think there should have been any.

Chris