On 9 March 2015 at 10:31, Dima Pasechnik <[email protected]> wrote: > On 2015-03-09, John Cremona <[email protected]> wrote: >> In preparing an example for a course I discovered this seriously >> misleading feature: >> >> sage: n=(10^19-1)/9 >> sage: n.factor() >> 1111111111111111111 >> sage: n.is_prime() >> False >> sage: ZZ(n).is_prime() >> True >> >> What is happening is that when I defined n I used / so that I defined >> a rational number. And in QQ, there are no primes. >> >> sage: n = (10^19-1)//9 >> sage: n.is_prime() >> True >> >> I don't think there is a good solution for this but surely it will >> cause confusion (it confused me for at least 5 minutes). > > I don't even see the meaning of QQ(n).factor() > (Prime) factoring in a field is meaningless, IMHO...
Come on, be realistic! If the firls is the field of fractions of a UFD then tere is a very well-defined notion of factorization, which is useful. I used to get very frustrated with Magma when I asked to factor the discriminant of an elliptic curve over QQ -- something one needs to do a lot! -- and it refused because the integral discriminant had QQ as parent. In any case, I was just sending out a warning, as this will confuse students: sage: n = 10/2 sage: n 5 sage: n.is_prime() False John > > Dima > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
