| 1 | initial version |
When you write (say):
sage: mod(7,3)
1
you define an element of the ring of integers modulo 3, not an integer:
sage: mod(7,3).parent()
Ring of integers modulo 3
In particular, there is no adition between elements of incompatible such rings:
sage: mod(7,3) + mod(5,2)
TypeError: unsupported operand parent(s) for '+': 'Ring of integers modulo 3' and 'Ring of integers modulo 2'
If you want an integer, you should use %:
sage: 7 % 3
1
sage: (7 % 3).parent()
Integer Ring
sage: 7%3 + 5%2
2
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.