octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #43041] isprime(5i) returns true


From: Jordi Gutiérrez Hermoso
Subject: [Octave-bug-tracker] [bug #43041] isprime(5i) returns true
Date: Sun, 24 Aug 2014 14:45:39 +0000
User-agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36

Follow-up Comment #5, bug #43041 (project octave):

It is convenient for many purposes to define a prime number as a non-unit
number that divides a factor whenever it divides a product (a unit is a number
that divides 1). This is the definition that generalises to any integral
domain. Following this definition, both Maxima's and GAP's isprime() and
IsPrimeInt() respectively consider negative prime numbers to be prime.
Interestingly, Pari/GP, which is actually specialised for number theory,
excludes negative prime numbers from its isprime() function.

Since I consider "Matlab compatibility" to allow not erroring out when Matlab
errors out, and since Matlab errors out on negative integers, I think we can
pick whichever definition works out. I prefer to consider negative primes as
primes, but if you feel strongly otherwise, feel free to make the change to
exclude them or to further document my implementation.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43041>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]