Difference between revisions of "Integer"

(updated for the intro to programming course)
Line 1: Line 1:
An '''integer''' is one of the numbers obtained in counting the [[natural number]]s (<math>1,2,3,\ldots</math>), zero (<math>0</math>), or the negatives of the natural numbers (<math>-1,-2,-3,\ldots</math>). If <math>a</math> and <math>b</math> are integers, then their sum <math>a+b</math>, their difference <math>a-b</math>, and their product <math>ab</math> are all integers, but their quotient <math>a\div b</math> may or may not be an integer, depending on whether <math>a</math> can be divided by <math>b</math> with no remainder.
+
An '''integer''' is one of the numbers obtained in counting the [[natural number]]s (<math>1,2,3,\ldots</math>), zero (<math>0</math>), or the negatives of the natural numbers (<math>-1,-2,-3,\ldots</math>). If <math>a</math> and <math>b</math> are integers, then their sum <math>a+b</math>, their difference <math>a-b</math>, and their product <math>ab</math> are all integers (that is, the integers are closed under addition and multiplication), but their quotient <math>a\div b</math> may or may not be an integer, depending on whether <math>a</math> can be divided by <math>b</math> with no remainder.
  
The class of integers is the simplest class of numbers and is used to construct other classes like [[rational number|rational numbers]] and [[real numbers]]. The set of integers is symbolically written as <math>\mathbb{Z}</math>.
+
The class of integers is the simplest class of numbers and is used to construct other classes like the [[rational number]]s and [[real number]]s. The set of integers is symbolically written as <math>\mathbb{Z}</math>.
 +
 
 +
==Integers in Computer Science==
 +
In [[Python]] and just about all other programming languages integers are a primitive datatype.  In most languages integers are stored in a fixed amount of space (typically 32 bits), which limits their maximum value (typically to <math>2^{31}-1</math> for signed 32-bit integers).  However, integers in Python can be of arbitrary size, theoretically limited only by computer memory.
 +
 
 +
All the standard numerical [[operator]]s work on integers, as will the [[relational operator]]s.
  
 
== See Also ==
 
== See Also ==
Line 8: Line 13:
 
[[Category:Definition]]
 
[[Category:Definition]]
 
[[Category:Number theory]]
 
[[Category:Number theory]]
 +
[[Category:Introduction to Programming]]

Revision as of 14:20, 10 March 2011

An integer is one of the numbers obtained in counting the natural numbers ($1,2,3,\ldots$), zero ($0$), or the negatives of the natural numbers ($-1,-2,-3,\ldots$). If $a$ and $b$ are integers, then their sum $a+b$, their difference $a-b$, and their product $ab$ are all integers (that is, the integers are closed under addition and multiplication), but their quotient $a\div b$ may or may not be an integer, depending on whether $a$ can be divided by $b$ with no remainder.

The class of integers is the simplest class of numbers and is used to construct other classes like the rational numbers and real numbers. The set of integers is symbolically written as $\mathbb{Z}$.

Integers in Computer Science

In Python and just about all other programming languages integers are a primitive datatype. In most languages integers are stored in a fixed amount of space (typically 32 bits), which limits their maximum value (typically to $2^{31}-1$ for signed 32-bit integers). However, integers in Python can be of arbitrary size, theoretically limited only by computer memory.

All the standard numerical operators work on integers, as will the relational operators.

See Also