Can I convert integermod_int to int?
I need to do an and operation between element of vector with IntegerModRing(mynumber), but I get
if(element==(element & 3)): TypeError: unsupported operand type(s) for &: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' and 'int'
don't mind element ==element(&3) It's just to see if works.
for element in v0:
if(element==(element & 3)):
print "ok"
is there a function that let me do this?
Welcome to Ask Sage! Thank you for your question!
Can you provide minimal complete code allowing to reproduce the issue?
Some code that other users can copy and paste in a Sage session to see for themselves what goes wrong, and explore how to solve the issue.
To display inline code, like
z = x*y
, use backticks.To display blocks of code or error messages, skip a line above and below, and do one of the following (all give the same result):
For instance, typing
produces:
Please edit your question to do that.