# Notation of numbers

Notation of numbers is a way in which all numbers are represented, by using a limited set of different digits. Notation that is used currently for representing numbers is called positional notation (or place-value notation), in contrast to some ancient notations, such as Roman numerals.

- For example, a four-digit number a
_{3}a_{2}a_{1}a_{0}in the numeral system of base b means: a_{3}b^{3}+ a_{2}b^{2}+ a_{1}b^{1}+ a_{0}b^{0}

Nowadays, most people use the decimal numeral system, however for example the Celts (and the Elves in Tolkien's Middle-earth) used the duodecimal system. All computers use the binary numeral system. Due to the convenience of presenting and easy conversion between binary and hexadecimal systems (one character in the hexadecimal system corresponds to exactly four characters in the binary numeral system), the hexadecimal system is often used for presenting numbers stored by computers (using the binary system).

A non-negative integer in the numeral system of base b may be presented as:

(d_{k-1}d_{k-2}...d_{1}d_{0})_{b}

where:

d_{k-1}, d_{k-2}, ..., d_{1}, d_{0} are digits (in the range 0 to b-1)

## Base conversion algorithm

To write a number n in the numeral system of base b one can use the following algorithm:

- Divide n by b producing a quotient and a remainder (this is called the Euclidean division).
- The remainder put as the last digit of the outcome.
- Put the quotient in place of n.
- Repeat the steps above to receive the next last but one digit of the outcome and other earlier digits.
- Stop the algorithm when the result of dividing is equal to 0.

For example, to present a number 19 using the binary numeral system the following steps should be executed:

19/2 = 9 + 1

9/2 = 4 + 1

4/2 = 2 + 0

2/2 = 1 + 0

1/2 = 0 + 1

19 = (100011)_{2}

Whereas, to present a number 19 using the numeral system of base seven one should perform the steps:

19/7 = 2 + 5

2/7 = 0 + 2

19 = (25)_{7}

The algorithm can also be used to change numbers that are written in the numeral system of smaller base into numbers in the numeral system of bigger base.

## Number of digits

An integer n, which satisfies the inequality b^{k-1} <= n < b^{k} has k digits in a numeral system of base b. This relationship can be represented by the logarithm:

number of digits = [log_{b}n] + 1

where:

a symbol [] means the integer part of the number.