From: Jacob Fugal Date: 2009-03-07T04:42:24+09:00 Subject: [ruby-core:22704] Re: [Bug #1243] 1 is prime I have a hard time imagining a situation where asking if a negative number is prime would be necessary. Code the cares about prime numbers almost by design implies that it expects positive integers. In that mindset, I call YAGNI. There is no compelling argument (to me) to have the Ruby standard library definition of prime be inconsistent with the mathematical definition. A prime number -- not a prime factor or a prime element of the ring of integers or a prime element of any other arbitrary ring -- is a natural number (that is, a positive -- or non-negative, it doesn't matter here -- integer) which has exactly two distinct natural number divisors: 1 and itself. 1 is not prime and negative integers are not prime. Rationals or Floats not coinciding with an integer are not prime. That should be the definition of "prime?". In the rare case where someone does need to check if the absolute value of a negative integer x is prime, x.abs.prime? is not a horrible burden, and it reveals the intent that negative numbers are acceptable input to boot. Jacob Fugal