n1 + n2
The operator + evaluates to the sum of the two integers n1
and n2.
n1 - n2
The operator - evaluates to the difference of the two integers
n1 and n2.
n1 * n2
The operator * evaluates to the product of the two integers
n1 and n2.
n1 / n2
The operator / evaluates to the quotient of the two integers
n1 and n2. If the divisor does not divide the dividend
the quotient is a rational (see Rationals). If the divisor is 0 an error is
signalled. The integer part of the quotient can be computed with QuoInt
(see QuoInt).
n1 mod n2
The operator mod evaluates to the smallest positive
representative of the residue class of the left operand modulo the right, i.e.,
i mod k is the unique m in the
range [0 .. AbsInt(k)-1] such that k
divides i - m. If the right operand is 0
an error is signalled. The remainder of the division can be computed with
RemInt (see RemInt).
n1 ^ n2
The operator ^ evaluates to the n2-th power of the
integer n1. If n2 is a positive integer then n1^n2
is n1* n1* ..* n1 (n2
factors). If n2 is a negative integer n1^n2
is defined as 1 / (n1^(-n2)). If 0 is raised
to a negative power an error is signalled. Any integer, even 0, raised to the
zeroth power yields 1.
Since integers embed naturally into the field of rationals all the rational operations are available for integers too (see Operations for Rationals).
For the precedence of the operators see Operations.
gap> 2 * 3 + 1;
7