### Calculating with numbers: Computing with integers

### Natural numbers and integers

When counting objects you usually start with \(1\) and continue adding \(1\). So you get in succession the numbers \(1,\;\;2=1+1,\;\; 3=2+1=1+1+1\), etcetera. In order to indicate the absence of an object one needs the number \(0\). You may also count down from \(0\) and then you get successively the numbers \(-1=0-1,\;\; -2=-1-1,\;\;-3=-2-1=-1-1-1\), etcetera. In this way all integers are constructed.

Natural numbers The sequence \(0, 1, 2, 3, \ldots\) is the sequence of the natural numbers. These are the numbers to count with or to index. The set of **natural numbers** is symbolized by \(\mathbb{N}\). So \[\mathbb{N}=\{0,1,2,3,\ldots\}\]

Yes or no zero You could argue whether the number 0 belongs to the natural numbers or not: In counting objects, after all, you start counting from 1. But since the axiomatic introduction of natural numbers by the 19th-century mathematician Peano zero is commonly considered a natural number. too Moreover, when using the natural numbers as index, it is convenient to take the lowest index 0. In modern programming languages, this convention almost always is used, sometimes in direct reference to the manucript EWD831 of the Dutch mathematician and computer scientist Edsger Wybe Dijkstra on this topic. For these reasons, we adopt the convention that 0 is a natural number.

A much used notation for the above choice is: \(\mathbb{N}=\{0,1,2,3,\ldots\}\) and \(\mathbb{N}_0=\{1,2,3,\ldots\}\). In other words: \(\mathbb{N}_0\) symbolises the set of all natural numbers without \(0\).

Integers The arithmetic of natural numbers goes well if you add such numbers. But subtraction of natural numbers sometimes causes problems. What, for example, would the outcome of \(1-2\) or \(2-3\) be and do we mean the same number with that? In other words, what is the solution of the equation \(x+2=1\) or the equation \(x+3=2\)? The wish to be able to solve such equations gives rise to the introduction of the set of **integers**, symbolized by \(\mathbb{ℤ}\).

Integers can be placed on a number line: Begin with a first point on a straight line and give it the label 0 and choose a second point that get the label 1. We agree that the distance between these two points is equal to 1. Now continue with steps of length 1 and place the next integer on the number line with its label. Each number has a successor. Do the same now in the other direction and let each number have a predecessor, and you get the following **number line**:

So \[\mathbb{ℤ}=\{\ldots, -2, -1, 0, 1, 2, \ldots\}\] The numbers from this collection can be added, subtracted and multiplied with each other.