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 a3a2a1a0 in the numeral system of base b means: a3b3 + a2b2 + a1b1 + a0b0
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:
(dk-1dk-2...d1d0)b
where:
dk-1, dk-2, ..., d1, d0 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 bk-1 <= n < bk has k digits in a numeral system of base b. This relationship can be represented by the logarithm:
number of digits = [logbn] + 1
where:
a symbol [] means the integer part of the number.