Ask Your Question
0

ArithmeticError: reduction modulo not defined

asked 2021-03-11 08:18:23 +0100

Miroslaw gravatar image

updated 2021-03-11 10:32:16 +0100

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 flag offensive close merge delete

Comments

  • 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.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-03-11 10:00:16 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-03-11 15:18:09 +0100

Emmanuel Charpentier gravatar image

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...

edit flag offensive delete link more
0

answered 2021-03-11 16:42:25 +0100

Max Alekseyev gravatar image

updated 2021-03-11 16:48:57 +0100

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)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-03-11 08:18:23 +0100

Seen: 1,620 times

Last updated: Mar 11 '21