Module: sage.rings.integer_mod
An element of the integers modulo
.
Module-level Functions
n, m) |
Return the equivalence class of n modulo m
as an element of
.
sage: x = Mod(12345678, 32098203845329048) sage: x 12345678 sage: x**100 1017322209155072
You can also use the lowercase version:
sage: mod(12,5) 2
n, m) |
Return the equivalence class of n modulo m
as an element of
.
sage: x = Mod(12345678, 32098203845329048) sage: x 12345678 sage: x**100 1017322209155072
You can also use the lowercase version:
sage: mod(12,5) 2
Class: IntegerMod
self, parent, value, [construct=False]) |
sage: a = Mod(10,30); a 10 sage: loads(a.dumps()) == a True
Functions: copy,
crt,
is_square,
is_unit,
lift,
log,
modulus,
multiplicative_order,
order,
rational_reconstruction,
sqrt
self, other) |
Use the Chinese Remainder Theorem to find an element of the integers modulo the product of the moduli that reduces to self and to other. The modulus of other must be coprime to the modulus of self.
self, a) |
Return
such that
, where
is self.
INPUT: self, a are units in the integers modulo $N$. OUTPUT: Integer $x$ such that $a^x = b$, if it exists. Raises a ValueError exception if no such $x$ exists.
sage: R = Integers(500) sage: b = R(17); a = b^19 sage: b.log(a) 19
Author: David Joyner and William Stein (2005-11)
self) |
Returns the additive order of self.
self) |
Returns the additive order of self.
self) |
sage: R = IntegerModRing(97) sage: a = R(2) / R(3) sage: a 33 sage: a.rational_reconstruction() 2/3
Special Functions: __cmp__,
__float__,
__int__,
__invert__,
__long__,
__mod__,
__neg__,
_add_,
_div_,
_gap_init_,
_integer_,
_latex_,
_magma_init_,
_mul_,
_pari_,
_pari_init_,
_rational_,
_repr_,
_sub_
self) |
Return string representation of corresponding GAP object.
This can be slow since non-prime GAP finite field elements are represented as powers of a generator for the multiplicative group, so the discrete log problem must be solved.
Note:
This function will create a meaningless GAP object if the
modulus is not a power of a prime. Also, the modulus must
be
.
sage: a = Mod(2,19) sage: gap(a) Z(19) sage: a._gap_(gap) Z(19) sage: gap(a).Int() 2 sage: b = Mod(0,25) sage: gap(b) 0*Z(5)
self) |
Coercion to Magma.
sage: a = Integers(15)(4) sage: b = magma(a) # optional sage: b.Type() # optional RngIntResElt sage: b^2 # optional 1
See About this document... for information on suggesting changes.