|
The ring of integers is automatically created when Magma is first loaded.
The ring may be formally created (and, if desired, assigned to a variable)
using the function IntegerRing(). Subrings of Z are always
ideals; see the section on ideals for details.
Integers() : -> RngInt
RingOfIntegers() : -> RngInt
IntegerRing(Q) : FldRat -> RngInt
Integers(Q) : FldRat -> RngInt
RingOfIntegers(Q) : FldRat -> RngInt
Create the ring of integers Z.
Since the ring of integers is present when Magma is started up,
integers typed into Magma without any explicit context will be
regarded as elements of the ring of integers. Integers can be
specified using both decimal and hexadecimal notation.
One(Z) : RngInt -> RngIntElt
Identity(Z) : RngInt -> RngIntElt
Zero(Z) : RngInt -> RngIntElt
Representative(Z) : RngInt -> RngIntElt
These generic functions
create 1, 1, 0, and 0 respectively, in the integer ring Z.
Given a succession of decimal digits a1, ..., ar, create the
corresponding integer. Leading zeros will be ignored.
Given a succession of hexadecimal digits a1, ..., ar, create the
corresponding integer. Leading zeros will be ignored.
Given a succession of decimal digits a1, ..., ar, create the
corresponding integer as an element of Z.
Given a succession of hexadecimal digits a1, ..., ar, create the
corresponding integer as an element of Z.
Z ! [a] : RngInt, [RngElt] -> RngIntElt
Coerce the ring element a into the ring of integers Z. The element a
is allowed to be an element of the ring of integers modulo m
(in which case the result r satisfies 0 ≤r < m), or an element
of a finite field
(in which case the result r satisfies 0 ≤r < p
if a is in the prime field, of characteristic p, and an error
otherwise), or an element of the integers, rationals, a quadratic field,
a cyclotomic field or a number field (in which cases the result is
the obvious integer if a is integral and an error otherwise).
> Z := IntegerRing();
> n := 1234567890;
> n in Z;
true
> m := elt< Z | 1234567890 >;
> m eq n;
true
> l := Z ! elt< QuadraticField(3) | 1234567890, 0>;
> l;
1234567890
> k := elt< Z | 0x499602D2 >;
1234567890
Magma supports the printing of integers in both decimal and hexadecimal form.
The default print method is to print integers in base 10; base 16 printing is
performed using the Hex print level.
> n := 1234567890;
> n;
1234567890
> n:Hex;
0x499602D2
FactorisationToInteger(s) : [ <RngIntElt, RngIntElt> ] -> RngIntElt
Facint(s) : [ <RngIntElt, RngIntElt> ] -> RngIntElt
Given a sequence of two-element tuples
s=[ <p1, k1>, ..., <pr, kr> ] containing pairs of integers
<pi, ki>, 1 ≤i ≤r, with ki non-negative, this function
returns the integer p1k1 ... prkr. It is normally
used for converting a factorization sequence to the corresponding integer.
Intseq(n, b) : RngIntElt, RngIntElt -> [RngIntElt]
Given a non-negative integer n and a positive integer b≥2,
return the unique base b representation of n in the form of
a sequence Q. That is, if
n = a0b0 + a1b1 + ... + ak - 1bk - 1 with 0≤ai<b and
ak - 1> 0, then Q = [ a0, a1, ..., ak - 1 ]. (If n=0, then
Q=[ ].)
Seqint(s, b) : [RngIntElt], RngIntElt -> RngIntElt
Given a positive integer b≥2 and a sequence Q = [ a0, ...,
ak - 1 ] of non-negative integers such that 0 ≤ai < b, return the
integer n = a0b0 + a1b1 + ... + ak - 1bk - 1. If Q is the
empty sequence, the integer zero is returned. This function performs
the inverse operation of the base b representation.
Create the string consisting of the decimal digits of the integer n.
In the case in which n is negative the first character will be the
minus sign.
Create the string consisting of the digits of the integer n in base b. In
the case in which n is negative the first character will be the minus sign.
The base b can be between 2 and 36. For b ≤10, the digits are
represented numerically. For b > 10, the digits are represented both
numerically and alphabetically, so that, 10 is `A', 11 is `B', et cetera.
The sequence [n] which can be coerced back into Z.
The denominator of n, ie. 1.
[Next][Prev] [Right] [Left] [Up] [Index] [Root]
|