# ArithmeticError: reduction modulo not defined

I have tried performed modulo operation:

and I got this:

ArithmeticError                           Traceback (most recent call last) <ipython-input-1-b13f3c6e195a> in <module>

54     print(" po podziale x 2")
55     xP, yP = Pp.xy()
---> 56     uu = xQ % xP

57     print( f"uu mod = {(uu)} " )

/home/sc_serv/sage/local/lib/python3.8/site-packages/sage/rings/finite_rings/integer_mod.pyx in sage.rings.finite_rings.integer_mod.IntegerMod_abstract.__mod__ (build/cythonized/sage/rings/finite_rings/integer_mod.c:7287)()
493         R = IntegerModRing(modulus)
494         if (<Element>self)._parent._IntegerModRing_generic__order % R.order():
--> 495             raise ArithmeticError(f"reduction modulo {modulus!r} not defined")
496         return R(self)
497

ArithmeticError: reduction modulo 55066263022277343669578718895168534326250603453777594175500187360389116729240 not defined


i don't understand in python work

xQ = 0x5699b93fc6e1bd29e09a328d657a607b4155b61a6b5fcbedd7c12df7c67df8f5

xP = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798

edit retag close merge delete

• I reformatted your question to present Sage's output without reformatting, in order to facilitate reading. You van do that by selecting the relevant text andclick on the "101010" button.

• What are the parents of xQ and xP ?

• Your question might be answerable if you could post you source code or, better, a minimal example exhibiting your problem.

( 2021-03-11 10:00:16 +0100 )edit

Sort by » oldest newest most voted

WorksForMe(TM) in 9.3.beta8 :

sage: xQ = 0x5699b93fc6e1bd29e09a328d657a607b4155b61a6b5fcbedd7c12df7c67df8f5
sage: xP = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
sage: xQ%xP
39170511121567495843205514895817413266634475076437334144150038082329899825397


xP and/or xQ may be different of what you think they are. Check your code upstream of line 56...

more

Apparently, xP and xQ are coordinates of some points on an elliptic curve over a finite field $\textrm{GF}(p)$. In this case they represent residues modulo $p$, and operation % is not defined for them. If one wants to treat them as integers, lifting is needed: uu = lift(xQ) % lift(xP)

more