#17852: Small cleanup in rings.arith and rings.integer
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.6
Component: basic arithmetic | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers: Jeroen Demeyer
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/17852 | 4f0ca87b9f64858a22f3fcd23b63526ba7622f55
Dependencies: #16878 | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by jdemeyer):
* status: needs_review => needs_work
Comment:
I thought a bit more about the invertibility check: in fact it has nothing
to do with integral domains, but with the ''characteristic'' of the ring.
This is also not well-defined, despite `R` being a field:
{{{
sage: R = Zmod(7)
sage: binomial(R(10), 7)
1
sage: R(binomial(17, 7))
2
}}}
The correct condition is that `factorial(m)` should be coprime to the
characteristic of the ring. So the code should be something like
{{{
try:
c = P.characteristic()
except AttributeError:
# Assume that P has characteristic zero
pass
else:
if any(c.gcd(k) > 1 for k in range(2, m+1)):
...
}}}
(you don't need `Q` for this)
The example with `Zmod(7)` should be added as doctest.
--
Ticket URL: <http://trac.sagemath.org/ticket/17852#comment:85>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/d/optout.