# Octal and hexadecimal number system. Translation rules.

The concept of the number system

Number system – a set of techniques and rules for writing numbers using a certain set of characters.

Types of number systems

There are positional and non-positional number systems.

Number systems in which each digit corresponds to a value that does not depend on its place in the notation of the number is called non-positional.

An example of a non-positional number system is the Roman system (Roman numerals). In the Roman system, Latin letters are used as numbers:

Example 1. The number CCXXXII consists of two hundred, three tens and two units and is equal to two hundred and thirty two.

Roman numerals are written from left to right in descending order. In this case, their values are added. If a smaller number is written on the left, and a large number on the right, then their values are subtracted.

Example 2

VI u003d 5 + 1 u003d 6, and IV u003d 5-1 u003d 4.

Positional number system – a number system in which the value of each digit in a number entry depends on its position (digit). The number of digits (characters) used to represent numbers is called the base of the number system.

The number system used in modern mathematics is the positional decimal system. Its base is ten, since all numbers are written using ten digits:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

To write numbers in the positional system with base n , you need to have an alphabet of n digits. Usually, for this, for n < 10, the first n Arabic numerals are used, and for n > 10, letters are added to ten Arabic numerals. Here are examples of alphabets from several systems:

 Base Name Alphabet n = 2 Binary 0 1 n = 3 ternary 0 1 2 n = 8 octal 0 1234567 n =16 Hexadecimal 0123456789ABCDEF

If it is required to indicate the base of the system to which the number belongs, then it is assigned a subscript to this number. For example:

101101 2 , 367l 8 , 3B8F 16 .

3. Algorithm for converting numbers from an arbitrary number system to decimal ( replacement algorithm ):

To convert a number of the number system with base n to decimal, it is necessary to represent this number as the sum of the products of the degrees of the base of the number system (i.e. n ) by the corresponding digits in the digits of the number.

Example 3. Convert numbers to decimal number system:

112 3 = 1 • 3 2 + 1• 3 1 + 2• 3° = 9 + 3 + 2 = 14 10 .

101101 2 = 1 • 2 5 + 0 • 2 4 + 1 • 2 3 + 1 • 2 2 + 0 • 2 1 + 1• 2° = 32 + 8 + 4 + 1= = 45 10 .

4. Algorithm for converting numbers from the decimal number system to other systems:

a. Consistently divide the given number and the resulting incomplete quotients by the basis of the new number system until we get an incomplete quotient less than the divisor;

b. The resulting residues, which are the digits of a number in the new number system, must be brought into line with the alphabet of the new number system;

c. Compose a number in the new number system, writing it down from the resulting remainders, starting with the last quotient.

Example 4. Convert the decimal number 19 to the binary number system. 19 10 =10011 2

5. Arithmetic in binary number system

Any positional number system is determined by the base of the system, the alphabet and the rules for performing arithmetic operations. The rules of arithmetic are based on tables of addition and multiplication of single-digit numbers. Addition and multiplication tables in binary number system look like this:

Example 5. Calculate in binary system:

a) 1101+110

b) 110*101  Octal and hexadecimal number system. Translation rules.

Binary octal table

 Octal number system Binary number system

 Hexadecimal number system Binary number system Hexadecimal number system Binary number system BUT AT With D E F

Algorithm for converting from binary number system to octal number system:

split into groups of 3 digits from right to left, starting with the least significant digit;

if there is not enough to complete a group of digits, then add the required number of zeros on the left;

Then each triple of digits is replaced by a digit of the octal number system, respectively.

Reverse conversion (from octal to binary): performed by replacing each octal digit with its binary equivalent.

To convert from binary to hexadecimal, the algorithm is the same, only the numbers are grouped by 4.

Example 6. Convert from binary to octal and hexadecimal number system number 101011001011 2

101011001011 2 = 101 011 001 011 2 = 5313 8

1010110010112= 1010 1100 10112= ACB16

Example 7. Convert the number 15FC 16 to binary:

We replace each digit in the hexadecimal number 15FC with the four binary characters corresponding to it in the table. In other words, we recode the number 15FC according to the table into binary form. It turns out:

15FC 16 =0001 0101 1111 1100 2 .

Task 1. Convert numbers from the decimal number system to binary, quinary, octal:

1) 523, 65, 700, 230, 325;

2) 12, 524, 76, 121, 56.

Task 2. Write down the numbers in decimal number system:

1) A5=34; A8=12;

2) A3=22; A6=37.

Task 3. Convert octal numbers to binary: 256; 321; 120; fifteen.

Task 4. Convert hexadecimal numbers to binary: 1AC7; FACC; DDF; 7B8D.

Task 5. Convert binary numbers to octal and hexadecimal number systems:

1) 110000110101; 1010101; 11100001011001;

2) 11011010001; 111111111000001; 10001111010.

Task 6. Perform actions in binary number system:

1) 1100+111;

2) 10101+101;

3) 11101+1110;

4) 1101+1001;

5) 11*11;

6) 111*11;

7) 101*10.