Can Prime numbers be negative? [duplicate]

I was wondering, can a prime number be negative? We had a question over at security.se which stated that prime generation with openssl:

openssl dhparam -text 1024


results in a 1024-bit number to which leading zeros are added (resulting in 1032 bits). It could be the case that this is done to sign the integer, however it was my believe that negative primes did not exist?

marked as duplicate by Yiorgos S. Smyrlis, A.P., Joel Reyes Noche, Julian Kuelshammer, graydadApr 29 '15 at 13:34

• Depends on the definition, but mathematicians consider $-7$ a prime, usually. In algebra, they are considered the "same prime" in some obvious sense. Usually, you don't need to deal with the negative primes, but in other algebras there's no obvious way to pick the "right" primes. – Thomas Andrews Aug 5 '13 at 4:27
• en.wikipedia.org/wiki/Prime_number – Amzoti Aug 5 '13 at 4:28
• on a sidenote, all these openssl computations should be performed with unsigned big integers and the padding to $1032$ bits is only needed to prevent an accidental interpretation of negative numbers in case some programmer forgot that restriction. :) – Hagen von Eitzen Aug 5 '13 at 5:54
• Since nobody bring that up yet, may I bring up Gaussian integers? In any case, it should not have any effect (at least not on RSA), other than the fact that you need to be careful when computing $\varphi$ and some implementation-dependent issue on dividing by negative number – Gina Jan 5 '14 at 19:26
• @ThomasAndrews is there anything you can cite pertainging to "mathematicians consider −7 a prime". I have just never heard of negatives being considered prime. Every defenition I have ever seen only considers Natrual numbers > 1. – KBusc Sep 8 '14 at 16:54

A prime number like $7$ represents all of the values that both divide 7 and are multiples of it. Then 7 simply os the representive form of it. So, of the integers, 7 represents both 7 and -7.

Sometimes you might want all primes to be 1 modulo 4 or 6, in which case, you might get -7 as the name form.

In other systems, like the gaussian integers, a prime likr $2+i$, can represent that and its multiples by powers of $i$. Other systems, like $x+y\sqrt{2}$, a prime like $1+2\sqrt{2}$, is one of an infinite number of values that divide this, and are divisable by this prime.

For the integers, it is usually representive to make the name prime greater than zero.

• Are you referring to prime ideals? – Zach L. Aug 5 '13 at 5:58
• I don't know that term. You can take in an integer set, that $x \mid y \mid x$, where $y = xU$ and U a unit. So for a prime $p$, one can use $pU$ as a representative value of it. In the integers, $U = \pm 1$. – wendy.krieger Aug 5 '13 at 8:05
• The sentence «A prime number like 7 represents all of the values that both divide 7 and are multiples of it» is quite confused. The number seven does not represent anything... – Mariano Suárez-Álvarez Jan 5 '14 at 19:11
• It is the numeral $7$ that represents a particular number, while the numeral $-7$ represents the opposite or additive inverse of $7$. – skullpatrol Jan 5 '14 at 20:21
• For the set N, all primes are positive, because the set itself is positive. But you have sets with negative numbers, and then one can use either 7 or -7 as a possible representive. Gauss law of quadratic recriprolity puts all primes >2 as $1 \pmod{4}$, so half the primes are negative. In other integer systems, numbers like 2 and 3 are composite, the is no unique representation of the primes involved because of multiple units. – wendy.krieger Jan 7 '14 at 3:40

Primes are always modulo units in algebra. For example, let $p(x)$ with coefficients in $\mathbb{R}$ be a polynomial that can not be divided by any other polynomial over $\mathbb{R}$. Then $a\cdot p(x)$ is prime for all $a\in \mathbb{R}$, $a\ne 0$.
A unit is an element with inverse, in this case $a$ is a unit-polynomial.