On Sat, Dec 10, 2011 at 11:52 PM, Keshav Kini <keshav.k...@gmail.com> wrote:
> Correct me if I'm wrong, but divisibility is only a partial order (and thus
> gcds are only unique) modulo associates. Everything but 0 is a unit in Z/7Z,
> an integral domain, so any of 1, 2, 3, 4, 5, or 6 would be an acceptable
> value for the gcd of 5 and 7(=0), no? Or is the "common parent" something
> other than Z/7Z?

Yes, you would be right if the parent were Z/7Z.   The natural choice
for the parent
should *definitely* be Z/7Z, since:

 sage: Sequence([Mod(5,7), 7]).universe()
 Ring of integers modulo 7

Any of the choices you mentioned above would be fine, but 5 is the
best answer, just like this is best:

 sage: gcd(6/1, 9/1)
 3
 sage: parent(gcd(6/1, 9/1))
 Rational Field

Now as you noticed, we have

sage: gcd(Mod(5,7), 7)
5
sage: parent(gcd(Mod(5,7), 7))
Integer Ring

which... sucks!    I consider this a bug.  We should definitely have
that the gcd is in parent(Mod(5,7)).

William

> I do see
>
> sage: gcd(Integers(7)(5), 7)
> 5
> sage: gcd(Integers(7)(5), 7).parent() is ZZ
> True
>
> which makes no sense.
>
> -Keshav
>
> ----
> Join us in #sagemath on irc.freenode.net !
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to