Integer
In mathematics, integers are whole numbers (natural numbers, their negatives, and zero).[1] Integers can also be shown on a number line like this:
[math]\displaystyle{ {...-4, -3, -2, -1, 0, +1, +2, +3, +4,...}\,\! }[/math]
In particular, zero or 0 is an integer that is neither positive nor negative. An integer is a whole number with no fractional or decimal part.
Integers have no smallest or largest value because for any given integer, there is always a larger and smaller integer. Any integer is either greater than or smaller than any other integer. Consecutive integers are integers that come after each other (as in [math]\displaystyle{ {1, 2, 3, 4} }[/math]).
The sum, difference, and product of integers is always an integer.
- For example, (12 + 2345 × (67 - 8)) × 9 is an integer.
An integer divided by an integer is sometimes not an integer.
- For example, 1 ÷ 2 = 0.5.
[math]\displaystyle{ \mathbf{Z} }[/math] or [math]\displaystyle{ \mathbb{Z} }[/math] is the name of the set of integers, and [math]\displaystyle{ \mathbb{Z}_+\! }[/math] is the set of positive integers.[2][3] ([math]\displaystyle{ \mathbf{Z} }[/math], +, 0) is an abelian group.
The number of integers is infinite. The cardinal number of [math]\displaystyle{ \mathbf{Z} }[/math] is [math]\displaystyle{ \aleph_0 }[/math]. The ordinal number of [math]\displaystyle{ \mathbf{Z} }[/math] is [math]\displaystyle{ ^*\omega + \omega }[/math].
To sum up, an integer is a whole number that has no decimals.
In programming
In some programming languages, like C and Python, there are types called "int" or "integer."
Somewhat confusingly [4] , integers don't always correspond to exactly one type in a programming language, such as:
char,short,int,long,long longin Cint,bignumin Python
All seven of the above types are integers.
"Unsigned" integers are not allowed to have a negative sign, such as [math]\displaystyle{ {0, +1, +2, +3, ...} }[/math]
"Signed" integers are allowed to have a negative sign (or positive sign or no sign), such as [math]\displaystyle{ {-3, -2, -1, 0, +1, +2, +3, ...} }[/math]
Integer Media
The integers arranged on a number line
Integers can be thought of as discrete, equally spaced points on an infinitely long number line. In the above, non-negative integers are shown in blue and negative integers in red.
A figure representing the equivalence classes of the relative numbers constructed as a pair of natural numbers. Any relative number (eg. -5) has an infinity of equivalent possible representation, eg. (2,7), (0,5), … The equivalent representations (in red) are on the same blue dotted line, and the number in blue at the end on the line is the corresponding relative number
Notes
- ↑ Negative numbers have a minus (−) in front of the number. Positive numbers have no sign or a plus (+) sign in front. Zero usually has no sign, but in rare cases such as One's Complement and Sign-magnitude, both [math]\displaystyle{ +0 }[/math] and [math]\displaystyle{ -0 }[/math] co-exist.
- ↑ Comprehensive List of Algebra Symbols (in en-US). Math Vault (2020-03-25). Retrieved 2020-08-11.
- ↑ Weisstein, Eric W.. Integer (in en). mathworld.wolfram.com. Retrieved 2020-08-11.
- ↑ Multiple types exist for integers due to the biggest and smallest representable numbers varying among the types.