• Educational complex Tue. Number systems. Transfer from one system to another

    Rule. To convert a number from one number system to another, you need to divide the original number by the base of the new number system. Divide the resulting quotient again by the base of the new number system, and continue the division until then. until the quotient is less than the base of the new number system. The resulting division remainders, starting from the last, are written in reverse order. This will be the recording of the number in the new number system.

    Example. Convert the number 135 from decimal SS to 2-ary, octal and hexadecimal number systems.

    1) 2) 3)

    Task 2.

    Convert the following numbers to binary, octal and hexadecimal SS: 1275,973, 172

    Reverse conversion of numbers from any SS to decimal.

    1) To convert a number from any SS to the original SS (reverse translation), you need to multiply each digit of this number by the base of the original SS. starting from the zero digit from right to left, and add the products. If you are converting a decimal fraction, you should apply the rule for writing the integer and fractional parts of the number.

    2) Reverse translation of numbers is carried out according to the formula:

    where A is a given number,

    g – SS base of a given number (=2 for 2-ary SS, for other SS - similar),

    m – the number of digits in the integer part of the number.

    n – number of digits in the fractional part of the number,

    a – the value of the digits of a given number (the fractional part of the number is highlighted in blue).

    110110 2 = 1*2 5 +1*2 4 +0*2 3 +1*2 2 +1*2 1 +0*2 0 =54 10

    66 8 =6*8 1 +6*8 0 =48+6=54 10 9A 16 =9*16 1 +10*16 0 =144+10=154 10

    13.4 8 =1*8 1 +3*8 0 +4*8 -1 =8+3+0.5=11.5 10 (this number is a decimal fraction)

    Task 3.

    Convert the following numbers to decimal SS:

    101,11 2 =5,75 10 1011001 2 1011,101 2

    125,7 8 =86 10 1253 8 175,132 8

    A19BA 16 =2585726… 10 16A3 16 2BAFD 16

    Translation of numbers with a base that is a power of 2 and reverse translation. These systems include binary, octal, and hexadecimal number systems.



    Rule. Convert from binary SS to octal SS. The binary number is divided into groups of 3 digits from the end (from right to left) and each group is converted into a number in a new SS

    10.000.101 2 =205 8

    111.000.101.100 2 =7054 8

    1.011.001.101 2 =1315 8

    Rule. For the reverse conversion, each octal digit is written as a triad.

    Rule. From binary SS to hexadecimal SS: similar, but separate 4 digits each

    0110.0110.1011 2 =66B 16

    1011.1111.0111 2 =BF7 16

    10.1010.0111.0001 2 =2A71 16

    Rule. For the reverse conversion, each hexadecimal digit is written as a tetrad.

    Translation of proper and improper fractions in different SS. If you need to convert a fraction, you must first convert it to a decimal, and then apply the rules for converting decimal fractions.

    Rule. Converting decimal fractions less than one (proper fractions).

    1) it is necessary to separate the fractional part with a vertical line;

    2) multiply the fractional part based on the new number system;

    3) write the result strictly under the original number, starting from the least significant digit; if you get a transfer to a whole part, then write it to the left of the line;

    4) multiplication of the fractional part is carried out until a number with the specified accuracy is obtained, or there is no 0 to the right of the line.

    0,728 10 =0,564 8

    Task 4. Convert the following proper fractions from decimal SS to binary, octal, hexadecimal SS: .

    Converting numbers from one number system to another is an important part of machine arithmetic. Let's consider the basic rules of translation.

    1. To convert a binary number to a decimal one, it is necessary to write it in the form of a polynomial consisting of the products of the digits of the number and the corresponding power of 2, and calculate it according to the rules of decimal arithmetic:

    When translating, it is convenient to use the table of powers of two:

    Table 4. Powers of number 2

    n (degree)

    Example.

    2. To convert an octal number to a decimal one, it is necessary to write it down as a polynomial consisting of the products of the digits of the number and the corresponding power of the number 8, and calculate it according to the rules of decimal arithmetic:

    When translating, it is convenient to use the table of powers of eight:

    Table 5. Powers of the number 8

    n (degree)

    Example. Convert the number to the decimal number system.

    3. To convert a hexadecimal number to a decimal one, it must be written down as a polynomial consisting of the products of the digits of the number and the corresponding power of the number 16, and calculated according to the rules of decimal arithmetic:

    When translating, it is convenient to use blitz of powers of number 16:

    Table 6. Powers of the number 16

    n (degree)

    Example. Convert the number to the decimal number system.

    4. To convert a decimal number to the binary system, it must be sequentially divided by 2 until a remainder less than or equal to 1 remains. A number in the binary system is written as a sequence of the last division result and the remainders from the division in reverse order.

    Example. Convert the number to the binary number system.

    5. To convert a decimal number to the octal system, it must be sequentially divided by 8 until a remainder less than or equal to 7 remains. A number in the octal system is written as a sequence of digits of the last division result and the remainder of the division in reverse order.

    Example. Convert the number to the octal number system.

    6. To convert a decimal number to the hexadecimal system, it must be sequentially divided by 16 until there remains a remainder less than or equal to 15. A number in the hexadecimal system is written as a sequence of digits of the last division result and the remainders from the division in reverse order.

    Example. Convert the number to hexadecimal number system.

    Tags: Number system, number system translation, related number systems

    Changing the base for positional number systems

    In a positional number system with base q, a number can be represented as a polynomial

    … + a 2 ∙q 2 + a 1 q 1 + a 0 ∙q 0 + a -1 ∙q -1 + a -2 ∙q -2 + …

    where the coefficients a i are the digits of the number system with base q.

    For example, in the decimal number system

    124.733 = 1∙10 2 + 2∙10 1 + 4∙10 0 + 7∙10 -1 + 3∙10 -2 + 3∙10 -3

    The number of digits in a number system with base q is equal to q, and the maximum digit is q - 1. A digit cannot become equal to q, because in this case the unit will be transferred to a new digit.

    For example, you need to find the minimum base of the number system in which the number 7832 is written. Since the maximum digit is 8, then the minimum value is q = 8 + 1 = 9.

    The base of a number system can, in principle, be any number: integer, negative, rational, irrational, complex, etc. We will consider only positive integer bases.

    Of particular interest to us will be the base 2 and the bases that are powers of two - 8 and 16.

    In case the base with. With. more than ten, then new numbers are taken in order from the alphabet. For example, for the hexadecimal system these will be the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

    Converting the whole part of the decimal number system

    The first way to convert from the decimal number system to the n-ary number system is to sequentially divide the number by a new base.

    123/12 = 10 (3) 10/12 = 0 (10=A)

    We collect in reverse order, first the last value (this is 0), then from top to bottom all the remainders. We get 0A3 = A3

    4563/8 = 570 (3) 570/8 = 71 (2) 71/8 = 8 (7) 8/8 = 1 (0)

    Putting it back together, we get 10723

    3349 10 → X 16

    3349/16 = 209 (5) 209/16 = 13 (1) 13/16 = 0 (13 = D)

    Putting it together: 0D15 = D15

    545/2 = 272 (1) 272/2 = 136 (0) 136/2 = 68 (0) 68/2 = 34 (0) 34/2 = 17 (0) 17/2 = 8 (1) 8/2 = 4 (0) 4/2 = 2(0) 2/2 = 1 (0) 1/2 = 0(1)

    We collect 01000100001 = 1000100001

    Translation on paper is usually done by dividing into a column. Until the division results in zero, each subsequent answer is divided by the base c. With. At the end, the answer is collected from the remainders of the division.

    It is also often possible to convert a number to another s. With. , if we mentally imagine it as the sum of powers of the corresponding base into which we want to convert the number.

    For example, 129 is obvious 128 + 1 = 2 7 + 1 = 10000001 2

    80 = 81 - 1 = 3 4 - 1 = 10000 - 1 = 2222 3

    Converting an integer part to the decimal number system

    The translation is carried out using the representation of the number in the positional number system. Let it be necessary to translate A3 12 → X 10 It is known that A3 is 3∙q 0 + A∙q 1 , that is, 3*1 + A*12 = 3 + 120 = 123

    10723 8 → X 10

    1∙q 4 + 0∙q 3 + 7∙q 2 + 2∙q 1 + 3∙q 0 = 1∙8 4 + 0 + 7∙8 2 + 2∙8 + 3 = 1∙4096 + 7∙64 + 2∙8 + 3 = 4563

    D∙16 2 + 1∙16 1 +5∙16 0 = 13∙256 + 16 + 5 = 3349

    1000100001 2 → X 10

    2 9 + 2 5 + 1 = 512 + 32 + 1 = 545.

    Translation on paper is usually carried out as follows. The degree number is written in order above each number. Then all the terms are written out.

    Converting the fractional part from the decimal system

    When converting a fractional part, a situation often occurs when a finite decimal fraction turns into an infinite one. Therefore, usually when translating, the accuracy with which it is necessary to translate is indicated. The translation is carried out by sequentially multiplying the fractional part by the base of the number system. The whole part is folded back and becomes part of the fraction.

    0.625 10 → X 2

    0.625 * 2 = 1.250 (1) 0.25 * 2 = 0.5 (0) 0.5 * 2 = 1.0 (1)

    0 – further multiplication will produce only zeros
    Collecting from top to bottom, we get 0.101

    0.310 → X2 0.3 * 2 = 0.6 (0) 0.6 * 2 = 1.2 (1) 0.2 * 2 = 0.4 (0) 0.4 * 2 = 0.8 (0) 0.8 * 2 = 1.6 (1) 0.6 * 2 = 1.2 (1 )

    0.2 ... we get a periodic fraction
    We collect, we get 0.0100110011001… = 0.0(1001)

    0.64510 → X5 0.645 * 5 = 3.225 (3) 0.255 * 5 = 1.275 (1) 0.275 * 5 = 1.375 (1) 0.375 * 5 = 1.875 (1) 0.875 * 5 = 4.375 (4) 0.375 * 5 = 1.8 75 (1 ) ...

    0.3111414… = 0.311(14)

    Converting the fractional part to the decimal system

    It is carried out similarly to the translation of an integer part, by multiplying the digit of the digit by the base to a degree equal to the position of the digit in the number.

    0.101 2 → X 10

    1∙2 -1 + 0∙2 -2 + 1∙2 -3 = 0.5 + 0.125 = 0.625

    0.134 5 → X 10

    1∙5 -1 + 3∙5 -2 +4∙5 -3 = 0.2 + 3∙0.04 + 4∙0.008 = 0.2 + 0.12 + 0.032 = 0.352

    Transfer from an arbitrary number system to an arbitrary one

    Conversion from an arbitrary number system to an arbitrary number system. With. carried out using decimal s. With.

    X N → X M ≡ X N → X 10 → X M

    For example

    1221201 3 → X 7

    1221201 3 = 1∙3 6 + 2∙3 5 + 2∙3 4 + 1∙3 3 + 2∙3 2 + 1 = 729 + 2∙243 + 2∙81 + 27 + 9 + 1 = 1414 10

    1414/7 = 202 (0) 202/7 = 28 (6) 28/7 = 4 (0) 4/7 = 0 (4)

    1221201 3 → 4060 7

    Related number systems

    Number systems are called related when their bases are powers of the same number. For example, 2, 4, 8, 16. Translation between related number systems can be carried out using the table

    Table for conversion between related number systems with base 2
    10 2 4 8 16
    0 0000 000 00 0
    1 0001 001 01 1
    2 0010 002 02 2
    3 0011 003 03 3
    4 0100 010 04 4
    5 0101 011 05 5
    6 0110 012 06 6
    7 0111 013 07 7
    8 1000 020 10 8
    9 1001 021 11 9
    10 1010 022 12 A
    11 1011 023 13 B
    12 1100 030 14 C
    13 1101 031 15 D
    14 1110 032 16 E
    15 1111 033 17 F

    To convert from one related number system to another, you first need to convert the number to the binary system. To convert to the binary number system, each digit of a number is replaced by the corresponding two (for quaternary), three (for octal) or four (for hexadecimal).

    For 123 4, one is replaced by 01, two by 10, three by 11, we get 11011 2

    For 5721 8 respectively 101, 111, 010, 001, total 101111010001 2

    For E12 16 we get 111000010010 2

    To convert from the binary system, you need to break the number into twos (4th), triples (8th) or fours of numbers (16th), and then replace them with the corresponding values.

    When you are setting up networks of various sizes and deal with calculations every day, you don’t need to create this kind of cheat sheet, everything is done on an unconditional reflex. But when you poke around in networks very rarely, you don’t always remember what the mask is in decimal form for the prefix 21 or what the network address is for the same prefix. In this regard, I decided to write several small articles-cheat sheets on converting numbers to various number systems, network addresses, masks, etc. In this part we will talk about converting numbers into different number systems.

    1. Number systems

    When you do anything related to computer networks and IT, you will come across this concept anyway. And as a smart IT professional, you need to understand this at least a little, even if in practice you will use it very rarely.
    Let's look at the translation of each digit from an IP address 98.251.16.138 in the following number systems:

    • Binary
    • Octal
    • Decimal
    • Hexadecimal

    1.1 Decimal

    Since the numbers are written in decimal, we will skip the conversion from decimal to decimal :)

    1.1.1 Decimal → Binary

    As we know, the binary number system is used in almost all modern computers and many other computing devices. The system is very simple - we only have 0 and 1.
    To convert a number with a tithe into binary form, you need to use division modulo 2 (i.e. integer division by 2), as a result of which we will always have a remainder of either 1 or 0. In this case, the result is written from right to left. An example will put everything in its place:


    Figure 1.1 – Converting numbers from decimal to binary


    Figure 1.2 – Converting numbers from decimal to binary system

    I will describe the division of the number 98. We divide 98 by 2, as a result we have 49 and the remainder 0. Next we continue division and divide 49 by 2, as a result we have 24 with a remainder 1. And in the same way we get to 1 or 0 in divisible. Then we write the result from right to left.

    1.1.2 Decimal → Octal

    The octal system is an integer number system with base 8. I.e. all numbers in it are represented in the range 0 – 7 and to convert from the decimal system you need to use division modulo 8.


    Figure 1.3 – Converting numbers from decimal to octal system

    The division is similar to the 2-point system.

    1.1.3 Decimal → Hexadecimal

    The hexadecimal system has almost completely replaced the octal system. It has a base of 16, but uses decimal digits from 0 to 9 + Latin letters from A (number 10) to F (number 15). You encounter it every time you check your network adapter settings - this is the MAC address. Same when IPv6 is used.


    Figure 1.4 – Converting numbers from decimal to hexadecimal

    1.2 Binary

    In the previous example, we converted all decimal numbers to other number systems, one of which is binary. Now let's convert each number from binary form.

    1.2.1 Binary → Decimal

    To convert numbers from binary to decimal, you need to know two nuances. The first is that each zero and one have a factor of 2 to the nth power, in which n increases from right to left by exactly one. The second is that after multiplying, all the numbers need to be added and we get the number in decimal form. As a result, we will have a formula like this:

    D = (a n × p n-1) + (a n-1 × p n-2) + (a n-2 × p n-3) +…, (1.2.1)

    Where,
    D is the decimal number we are looking for;
    n– the number of characters in a binary number;
    a – a number in binary form at the nth position (i.e. the first character, the second, etc.);
    p – coefficient equal to 2.8 or 16 to the power n(depending on the number system)

    For example, let’s take the number 110102. We look at the formula and write:

    • The number consists of 5 characters ( n=5)
    • a 5 = 1, a 4 = 1, a 3 = 0, a 2 = 1, a 1 = 0

    • p = 2 (since we are converting from binary to decimal)

    As a result we have:

    D = (1 × 2 5-1) + (1 × 2 5-2) + (0 × 2 5-3) + (1 × 2 5-4) + (0 × 2 5-5) = 16 + 8 + 0 + 2 + 0 = 26 10

    For those who are used to writing from right to left, the form will look like this:

    D = (0 × 2 5-5) + (1 × 2 5-4) + (0 × 2 5-3) + (1 × 2 5-2) + (1 × 2 5-1) = 0 + 2 + 0 + 8 + 16 = 26 10

    But, as we know, rearranging the terms does not change the sum. Let's now convert our numbers to decimal form.


    Figure 1.5 – Converting numbers from binary to decimal system

    1.2.2 Binary → Octal

    When translating, we need to divide the binary number into groups of three characters from right to left. If the last group does not consist of three characters, then we simply replace the missing bits with zeros. For example:

    10101001 = 0 10 101 001

    1011100 = 00 1 011 100

    Each group of bits is one of the octal numbers. To find out which one, you need to use the formula 1.2.1 written above for each group of bits. As a result we get.


    Figure 1.6 – Converting numbers from binary to octal system

    1.2.3 Binary → Hexadecimal

    Here we need to split the binary number into groups of four characters from right to left, followed by adding zeros to the missing bits of the group, as described above. If the last group consists of zeros, then they should be ignored.

    110101011 = 000 1 1010 1011

    1011100 = 0 101 1100

    001010000 = 00 0101 0000 = 0101 0000

    Each group of bits is one of the hexadecimal numbers. We use formula 1.2.1 for each group of bits.


    Figure 1.7 – Converting numbers from binary to hexadecimal

    1.3 Octal

    In this system, we may have difficulties only when converting to hexadecimal, since the rest of the translation goes smoothly.

    1.3.1 Octal → Binary

    Each number in the octal system is a group of three bits in the binary system, as described above. To translate, we need to use a cheat sheet:


    Figure 1.8 – Spur for converting numbers from the octal system

    Using this tablet, we will convert our numbers to the binary system.


    Figure 1.9 – Converting numbers from octal to binary

    I'll describe the conclusion a little. Our first number is 142, which means there will be three groups of three bits each. We use the spur and see that number 1 is 001, number 4 is 100 and number 2 is 010. As a result, we have the number 001100010.

    1.3.2 Octal → Decimal

    Here we use formula 1.2.1 only with a coefficient of 8 (i.e. p=8). As a result we have


    Figure 1.10 – Converting numbers from octal to decimal system

    • The number consists of 3 characters ( n=3)
    • a 3 = 1, a 2 = 4, a 1 = 2

    • p = 8 (since we are converting from octal to decimal)

    As a result we have:

    D = (1 × 8 3-1) + (4 × 8 3-2) + (2 × 8 3-3) = 64 + 32 + 2 = 98 10

    1.3.3 Octal → Hexadecimal

    As was written earlier, to translate, we first need to convert the numbers into the binary system, then from binary to hexadecimal, dividing them into groups of 4 bits. You can use the following spur.


    Figure 1.11 – Spur for converting numbers from the hexadecimal system

    This table will help you convert from binary to hexadecimal. Now let's convert our numbers.


    Figure 1.12 – Converting numbers from octal to hexadecimal

    1.4 Hexadecimal

    This system has the same problem when converting to octal. But more on that later.

    1.4.1 Hex → Binary

    Each number in hexadecimal is a group of four bits in binary, as described above. To translate, we can use the cheat sheet located above. As a result:


    Figure 1.13 – Converting numbers from hexadecimal to binary

    Let's take the first number - 62. Using the table (Fig. 1.11) we see that 6 is 0110, 2 is 0010, as a result we have the number 01100010.

    1.4.2 Hex → Decimal

    Here we use formula 1.2.1 only with a coefficient of 16 (i.e. p=16). As a result we have


    Figure 1.14 – Converting numbers from hexadecimal to decimal

    Let's take the first number. Based on formula 1.2.1:

    • The number consists of 2 characters ( n=2)
    • a 2 = 6, a 1 = 2

    • p = 16 (since we are converting from hexadecimal to decimal)

    As a result we have.

    D = (6 × 16 2-1) + (2 × 16 2-2) = 96 + 2 = 98 10

    1.4.3 Hex → Octal

    To convert to the octal system, you must first convert to binary, then divide it into groups of 3 bits and use the table (Fig. 1.8). As a result:


    Figure 1.15 – Converting numbers from hexadecimal to octal

    We will talk about IP addresses, masks and networks.

    Note 1

    If you want to convert a number from one number system to another, then it is more convenient to first convert it to the decimal number system, and only then convert it from the decimal number system to any other number system.

    Rules for converting numbers from any number system to decimal

    In computing technology that uses machine arithmetic, the conversion of numbers from one number system to another plays an important role. Below we give the basic rules for such transformations (translations).

      When converting a binary number to a decimal, you need to represent the binary number as a polynomial, each element of which is represented as the product of a digit of the number and the corresponding power of the base number, in this case $2$, and then you need to calculate the polynomial using the rules of decimal arithmetic:

      $X_2=A_n \cdot 2^(n-1) + A_(n-1) \cdot 2^(n-2) + A_(n-2) \cdot 2^(n-3) + ... + A_2 \cdot 2^1 + A_1 \cdot 2^0$

    Figure 1. Table 1

    Example 1

    Convert the number $11110101_2$ to the decimal number system.

    Solution. Using the given table of $1$ powers of the base $2$, we represent the number as a polynomial:

    $11110101_2 = 1 \cdot 27 + 1 \cdot 26 + 1 \cdot 25 + 1 \cdot 24 + 0 \cdot 23 + 1 \cdot 22 + 0 \cdot 21 + 1 \cdot 20 = 128 + 64 + 32 + 16 + 0 + 4 + 0 + 1 = 245_(10)$

      To convert a number from the octal number system to the decimal number system, you need to represent it as a polynomial, each element of which is represented as the product of a digit of the number and the corresponding power of the base number, in this case $8$, and then you need to calculate the polynomial according to the rules of decimal arithmetic:

      $X_8 = A_n \cdot 8^(n-1) + A_(n-1) \cdot 8^(n-2) + A_(n-2) \cdot 8^(n-3) + ... + A_2 \cdot 8^1 + A_1 \cdot 8^0$

    Figure 2. Table 2

    Example 2

    Convert the number $75013_8$ to the decimal number system.

    Solution. Using the given table of $2$ powers of the base $8$, we represent the number as a polynomial:

    $75013_8 = 7\cdot 8^4 + 5 \cdot 8^3 + 0 \cdot 8^2 + 1 \cdot 8^1 + 3 \cdot 8^0 = 31243_(10)$

      To convert a number from hexadecimal to decimal, you need to represent it as a polynomial, each element of which is represented as the product of a digit of the number and the corresponding power of the base number, in this case $16$, and then you need to calculate the polynomial according to the rules of decimal arithmetic:

      $X_(16) = A_n \cdot 16^(n-1) + A_(n-1) \cdot 16^(n-2) + A_(n-2) \cdot 16^(n-3) + . .. + A_2 \cdot 16^1 + A_1 \cdot 16^0$

    Figure 3. Table 3

    Example 3

    Convert the number $FFA2_(16)$ to the decimal number system.

    Solution. Using the given table of $3$ powers of the base $8$, we represent the number as a polynomial:

    $FFA2_(16) = 15 \cdot 16^3 + 15 \cdot 16^2 + 10 \cdot 16^1 + 2 \cdot 16^0 =61440 + 3840 + 160 + 2 = 65442_(10)$

    Rules for converting numbers from the decimal number system to another

    • To convert a number from the decimal number system to the binary system, it must be sequentially divided by $2$ until there is a remainder less than or equal to $1$. A number in the binary system is represented as a sequence of the last result of division and the remainders from division in reverse order.

    Example 4

    Convert the number $22_(10)$ to the binary number system.

    Solution:

    Figure 4.

    $22_{10} = 10110_2$

    • To convert a number from the decimal number system to the octal number system, it must be successively divided by $8$ until there is a remainder less than or equal to $7$. A number in the octal number system is represented as a sequence of digits of the last division result and the remainders from the division in reverse order.

    Example 5

    Convert the number $571_(10)$ to the octal number system.

    Solution:

    Figure 5.

    $571_{10} = 1073_8$

    • To convert a number from the decimal number system to the hexadecimal system, it must be successively divided by $16$ until there is a remainder less than or equal to $15$. A number in the hexadecimal system is represented as a sequence of digits of the last division result and the remainder of the division in reverse order.

    Example 6

    Convert the number $7467_(10)$ to hexadecimal number system.

    Solution:

    Figure 6.

    $7467_(10) = 1D2B_(16)$

      In order to convert a proper fraction from a decimal number system to a non-decimal number system, it is necessary to sequentially multiply the fractional part of the number being converted by the base of the system to which it needs to be converted. Fractions in the new system will be represented as whole parts of products, starting with the first.

      For example: $0.3125_((10))$ in octal number system will look like $0.24_((8))$.

      In this case, you may encounter a problem when a finite decimal fraction can correspond to an infinite (periodic) fraction in the non-decimal number system. In this case, the number of digits in the fraction represented in the new system will depend on the required accuracy. It should also be noted that integers remain integers, and proper fractions remain fractions in any number system.

    Rules for converting numbers from a binary number system to another

    • To convert a number from the binary number system to octal, it must be divided into triads (triples of digits), starting with the least significant digit, if necessary, adding zeros to the leading triad, then replace each triad with the corresponding octal digit according to Table 4.

    Figure 7. Table 4

    Example 7

    Convert the number $1001011_2$ to the octal number system.

    Solution. Using Table 4, we convert the number from the binary number system to octal:

    $001 001 011_2 = 113_8$

    • To convert a number from the binary number system to hexadecimal, it should be divided into tetrads (four digits), starting with the least significant digit, if necessary, adding zeros to the most significant tetrad, then replace each tetrad with the corresponding octal digit according to Table 4.