I see that despite the title of that ticket, this is (at present) about r%n when r =p/q is rational.
Questions: 1. What is the proposed behaviour when q is not invertible modulo n? Or more generally, if q*x=p (mod n) has no solutions, or more than one solution (mod n)? 2. Is the output going to be an element of Z/nZ, or of Z (as your sample code suggests)? John On 23 October 2016 at 15:14, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > Hello, > > In #21745 the behavior of (p/q) % n is proposed for a change. However > the current behavior (that is looking at the operation p * q^-1 modulo > n) is something useful that we want to keep. I would like to add a > method to rational numbers with this behavior, in other words > something equivalent to > > def my_method(self, n): > return (self.numerator() * self.denominator().inverse_mod(n)) % n > > or > > def my_method_bis(self, n): > return Zmod(n)(self).lift() > > Of course it is possible to optimize the implementation but I am > currently looking for a relevant name. Any suggestion? > > Cheers, > Vincent > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.