Home

ints

Integers, denoted Z, are the set of whole numbers together with their negatives, including zero. They exclude fractions and decimals. Integers are closed under addition and subtraction. For any integers a and nonzero b, there exist unique integers q and r such that a = bq + r and 0 ≤ r < |b|; this is the division algorithm and defines the remainder.

Mathematically, the integers form an infinite, countable, totally ordered ring with unity. They are closed under

Subsets include even and odd integers. Primes are integers greater than 1 with exactly two positive divisors;

In computing, integers are represented as fixed-width data types (for example 8, 16, 32, or 64 bits).

Applications of integers include counting, indexing, and numerous algorithms in mathematics and computer science, such as

addition
and
multiplication,
and
subtraction
provides
additive
inverses.
They
are
not
a
field
because
most
nonzero
integers
do
not
have
multiplicative
inverses
within
the
set.
The
absolute
value
maps
an
integer
to
its
distance
from
zero,
and
parity
distinguishes
even
from
odd
numbers.
gcd
and
lcm
describe
common
factors.
Bezout's
identity
states
that
for
any
integers
a
and
b,
there
exist
integers
x
and
y
with
ax
+
by
=
gcd(a,b).
They
can
be
signed
or
unsigned.
Two's
complement
is
a
common
representation
for
signed
integers.
Ranges
are
limited,
and
arithmetic
may
overflow,
wrapping
around
modulo
2^n
in
unsigned
arithmetic
or
causing
language-specific
behavior
in
signed
arithmetic.
modular
arithmetic,
primality
testing,
and
cryptography.
See
also
number
theory
and
integer
arithmetic
for
related
topics.