mpz_t
integer type.
copy,
crt,
denominator,
factor,
gcd,
inverse_mod,
is_one,
is_square,
is_square_free,
is_zero,
isqrt,
lcm,
parent,
pari,
powermod,
powermodm_ui,
set_si,
set_str,
sqrt,
str,
xgcd
These methods are defined as follows:
) |
Return a copy of the integer.
) |
Return the unique integer between 0
and
that is
congruent to the integer modulo
and to
modulo
. We
assume that
and
are coprime.
) |
Return the denominator of the integer.
) |
Return the prime factorization of the integer as a list of
pairs
, where
is prime and
is a positive integer.
) |
Return the greatest common divisor of self and
.
) |
Returns the inverse of self modulo
, if this inverse exists.
Otherwise, raises a exceptionZeroDivisionError exception.
INPUT: self -- Integer n -- Integer OUTPUT: x -- Integer such that x*self = 1 (mod m), or raises ZeroDivisionError. IMPLEMENTATION: Call the mpz_invert GMP library function.
sage: a = Integer(189) sage: a.inverse_mod(10000) 4709 sage: a.inverse_mod(-10000) 4709 sage: a.inverse_mod(1890) Traceback (most recent call last): ... ZeroDivisionError: Inverse does not exist. sage: a = Integer(19)**100000 sage: b = a*a sage: c=a.inverse_mod(b) Traceback (most recent call last): ... ZeroDivisionError: Inverse does not exist.
) |
Returns True
if the integers is
, otherwise
False
.
) |
) |
Returns True if this integer is not divisible by the square of any prime and False otherwise.
) |
Returns True
if the integers is 0
, otherwise False
.
) |
Returns the integer floor of the square root of self, or raises an ValueError if self is negative.
EXAMPLE:
sage: a = Integer(5) sage: a.isqrt() 2
) |
Returns the least common multiple of self and
.
) |
Return the ring
of integers.
) |
) |
powermod(self, Integer exp, Integer mod): Compute self**exp modulo mod.
) |
) |
Coerces
to a C signed integer if possible, and sets self
equal to
.
) |
Set self equal to the number defined by the string s in the given base.
) |
Returns the square root of self if self is a perfect square, or raises a ValueError exception otherwise.
EXAMPLE:
sage: a = Integer(4) sage: a.sqrt() 2.0
) |
Return the string representation of self
in the given
base.
n.str(b)
.
) |
Return a triple
such that
Instances of class Integer also have the following special methods:
) |
See About this document... for information on suggesting changes.