Hacker News new | past | comments | ask | show | jobs | submit login

What about negative primes? According to Wolfram Alpha:

http://www.wolframalpha.com/input/?i=-2+prime




I've always heard "prime number" defined to be greater than 1. WolframAlpha is probably just being crazy.

Wikipedia [1], and, more amusingly, Wolfram MathWorld [2] both agree with this definition.

[1]: http://en.wikipedia.org/wiki/Prime_number

[2]: http://mathworld.wolfram.com/PrimeNumber.html


Strictly speaking, the moment you ask "Is -2 prime?" you are asking a fundamentally different question from "is 2 prime?" because -2 is not in N = {0?, 1, 2, 3, ...}, the set over which the notion "prime" is defined.

There is a more general notion of primes which can be applied to any ring (a set with "addition-like" and "multiplication-like" operations). That is the notion of "prime ideals": https://en.wikipedia.org/wiki/Prime_ideal

On this account, there are "primes" for Z, and -2 is the "same prime" as 2.


Another definition[1] of prime in an arbitrary ring is

  p is prime if and only if p|ab implies p|a or p|b
which is equivalent to the prime ideal concept. Interestingly, these definitions mean that 0 is actually a prime in Z!

As explanation: the only number 0 divides is 0, and Z is an integral domain[2], i.e. ab = 0 implies a = 0 or b = 0, thus 0 divides at least one of a and b if 0 divides ab.

[1]: https://en.wikipedia.org/wiki/Prime_element [2]: https://en.wikipedia.org/wiki/Integral_domain


That's actually really cool and reminds me that I should learn some basic abstract algebra one of these days.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: