On Saturday, March 15, 2014 11:23:29 AM UTC-7, Sz Tengely wrote: > -------------------------------------------------------------------- > > I checked the code and I think it is easy to correct, in fact the solution > is > used a few lines below when x1-x2 has no inverse in Z/NZ: > > line 694: > if R.is_finite(): > N = R.characteristic() > from sage.rings.all import ZZ <-------this part is missing > N1 = N.gcd(ZZ(2*y1 + a1*x1 + a3)) > Hi Szabolcs,
I think there's a little more wrong with that code (which is only trying to compile a more informative error message, so functional code shouldn't really be affected by it): not all elements of finite rings can be lifted into the integers. Instead of testing R.is_finite(), we should probably test if R is a quotient of ZZ and then use (2*y1 + a1*x1 + a3).lift(). Then we don't even have to import ZZ (or just not bother and not throw an expensive error message anyway. This is just to facilitate a toy elliptic curve factoring, and reporting factors as substrings of an error message is far from optimal). An even cheaper option is to just not convert to ZZ at all. After all, gcd in the residue ring won't be a unit either: sage: N=35 sage: R=Integers(N) sage: n=R(28) sage: N.gcd(n) 7 sage: N.gcd(n).parent() Ring of integers modulo 35 we'll still have problems with other finite rings: sage: k.<r>=NumberField(x^2+5) sage: O=k.maximal_order() sage: R=O.quo(35,names="rr") sage: R.is_finite() NotImplementedError sage: R.characteristic() NotImplementedError Cheers, Nils -- 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 http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.