Module Author: William A. Stein (was@math.harvard.edu)
Section Author: William A. Stein (was@math.harvard.edu)
The integer
module has the following method:
-
Return the factorial
.
The input integer
must fit in an unsigned long int.
The class Integer
is defined
rings.integer
. Integers have the following methods:
-
Return a copy of the integer.
-
Return the unique integer between
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 the integer and
.
-
Returns the inverse of the integer modulo
, if this inverse exists.
Otherwise, raises a ZeroDivisionError exception.
-
Returns
True
if the integers is
, otherwise False
.
-
Returns
True
if the integers is
, otherwise False
.
-
Returns the least common multiple of the integer and
.
-
Return the ring
of integers.
-
Returns the floor of the square root of the integer.
-
Return the string representation of
self
in the given
base.
-
Coerces
to a C signed integer if possible, and sets the
integer equal to
.
Note:
Note that integers are mutable. According to the
implementors of gmpy
, another wrapper of GMP
for Python, this is ``bad''.
If you don't like it, don't use these functions.
-
Set the integer equal to the number defined by the string
in the given base.
-
Return a triple
such that
Integers also support the standard arithmetic operations, such
as +,-,*,/, abs
, mod
, float
Note:
The class Integer
is implemented in Pyrex, as a wrapper
of the GMP mpz_t
integer type.
Release 0.3, documentation updated on April 21, 2005.
See About this document... for information on suggesting changes.