Integer (source code)

= Integer
{title2=$\mathbb Z$}
{wiki}

An integer is a whole number, positive, negative, or zero. The <set> of all integers is
$$
\mathbb Z=\{\ldots,-3,-2,-1,0,1,2,3,\ldots\}.
$$
The <positive integers> are $1,2,3,\ldots$; the negative <integers> are their opposites $-1,-2,-3,\ldots$. Zero is neither positive nor negative. The <nonnegative integers> include zero and all the <positive integers>. On a <number line>, consecutive <integers> are one unit apart, negative <integers> lie to the left of zero, and <positive integers> lie to its right. <Prealgebra 2e by Lynn Marecek and others/3.1 Introduction to Integers>[Prealgebra 2e, §3.1: Locate Positive and Negative Numbers on the Number Line; Opposite Notation; Integers]{ref}

The <integers> let counting describe changes in both directions. If a counter starts at $-3$ and increases by five, it reaches $2$: $-3+5=2$. Decreasing that result by four gives $2+(-4)=-2$. In <addition> on the <number line>, the sign of the added <integer> chooses the direction and its <absolute value> gives the distance. The <additive inverse> $-a$ reverses the change made by $a$.

\Image[/integer-signed-number-line-addition.png]
{title=Signed <integers> and <addition> on a <number line>}
{description=Starting at $-3$, a change of $+5$ ends at $2$. A subsequent change of $-4$ ends at $-2$. The arrows indicate changes; the labelled points indicate <integers>. Zero separates the negative and positive sides.}

The <integers> have <closure under a binary operation> for <addition>, <subtraction> and <multiplication>: whenever $a,b\in\mathbb Z$, the results $a+b$, $a-b$ and $ab$ are still <integers>. Together these operations give the <integers> their <ring> structure.<A Computational Introduction to Number Theory and Algebra by Victor Shoup>[§7.1, p. 166, Definition 7.1; p. 167, Example 7.1: the integers with their usual addition and multiplication]{ref} For instance, $-3+5=2$, $-3-5=-8$, and $(-3)\cdot5=-15$. General <division> has no such closure: $1/2$ is a <rational number> but not an <integer>. Some divisions are exact, such as $(-6)/3=-2$; <division> by zero is undefined. <Euclidean division> instead produces an integer <quotient> and a <remainder>, so $7=3\cdot2+1$ retains the information that ordinary <division> puts into the <fraction> $7/3$.

An <integer> is the value, whereas its written <numeral> is an encoding. The <decimal representation> $205_{10}$ and the <binary representation> $11001101_2$ name the same <integer>. Changing <positional notation> changes how that value is displayed and how calculations are organized; it does not change the value itself.