Ask Your Question

Revision history [back]

You can patch Sage: make the change

diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx
index 738d4b05ab..7e0eb624cd 100644
--- a/src/sage/rings/finite_rings/integer_mod.pyx
+++ b/src/sage/rings/finite_rings/integer_mod.pyx
@@ -1863,7 +1863,7 @@ cdef class IntegerMod_abstract(FiniteRingElement):
         return self._mul_(~right)

     def _repr_(self):
-        return str(self.lift())
+        return "mod({},{})".format(self.lift(), self.modulus())

     def _latex_(self):
         return str(self)

Then run "sage -b" to rebuild the affected files.