How many digits are there in the octal system? Computer science - number system

Using this online calculator you can convert whole and fractional numbers from one number system to another. A detailed solution with explanations is given. To translate, enter the original number, set the base of the number system of the source number, set the base of the number system into which you want to convert the number and click on the "Translate" button. See the theoretical part and numerical examples below.

The result has already been received!

Converting integers and fractions from one number system to any other - theory, examples and solutions

There are positional and non-positional number systems. The Arabic number system, which we use in everyday life, is positional, but the Roman number system is not. In positional number systems, the position of a number uniquely determines the magnitude of the number. Let's consider this using the example of the number 6372 in the decimal number system. Let's number this number from right to left starting from zero:

Then the number 6372 can be represented as follows:

6372=6000+300+70+2 =6·10 3 +3·10 2 +7·10 1 +2·10 0 .

The number 10 determines the number system (in this case it is 10). The values ​​of the position of a given number are taken as powers.

Consider the real decimal number 1287.923. Let's number it starting from zero, position of the number from the decimal point to the left and right:

Then the number 1287.923 can be represented as:

1287.923 =1000+200+80 +7+0.9+0.02+0.003 = 1·10 3 +2·10 2 +8·10 1 +7·10 0 +9·10 -1 +2·10 -2 +3· 10 -3.

In general, the formula can be represented as follows:

C n s n +C n-1 · s n-1 +...+C 1 · s 1 +C 0 ·s 0 +D -1 ·s -1 +D -2 ·s -2 +...+D -k ·s -k

where C n is an integer in position n, D -k - fractional number in position (-k), s- number system.

A few words about number systems. A number in the decimal number system consists of many digits (0,1,2,3,4,5,6,7,8,9), in the octal number system it consists of many digits (0,1, 2,3,4,5,6,7), in the binary number system - from a set of digits (0,1), in the hexadecimal number system - from a set of digits (0,1,2,3,4,5,6, 7,8,9,A,B,C,D,E,F), where A,B,C,D,E,F correspond to the numbers 10,11,12,13,14,15. In the table Tab.1 numbers are presented in different number systems.

Table 1
Notation
10 2 8 16
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

Converting numbers from one number system to another

To convert numbers from one number system to another, the easiest way is to first convert the number to the decimal number system, and then convert from the decimal number system to the required number system.

Converting numbers from any number system to the decimal number system

Using formula (1), you can convert numbers from any number system to the decimal number system.

Example 1. Convert the number 1011101.001 from binary number system (SS) to decimal SS. Solution:

1 ·2 6 +0 ·2 5 + 1 ·2 4 + 1 ·2 3 + 1 ·2 2 + 0 ·2 1 + 1 ·2 0 + 0 ·2 -1 + 0 ·2 -2 + 1 ·2 -3 =64+16+8+4+1+1/8=93.125

Example2. Convert the number 1011101.001 from octal number system (SS) to decimal SS. Solution:

Example 3 . Convert the number AB572.CDF from hexadecimal number system to decimal SS. Solution:

Here A-replaced by 10, B- at 11, C- at 12, F- by 15.

Converting numbers from the decimal number system to another number system

To convert numbers from the decimal number system to another number system, you need to convert the integer part of the number and the fractional part of the number separately.

The integer part of a number is converted from decimal SS to another number system by sequentially dividing the integer part of the number by the base of the number system (for binary SS - by 2, for 8-ary SS - by 8, for 16-ary SS - by 16, etc. ) until a whole residue is obtained, less than the base CC.

Example 4 . Let's convert the number 159 from decimal SS to binary SS:

159 2
158 79 2
1 78 39 2
1 38 19 2
1 18 9 2
1 8 4 2
1 4 2 2
0 2 1
0

As can be seen from Fig. 1, the number 159 when divided by 2 gives the quotient 79 and remainder 1. Further, the number 79 when divided by 2 gives the quotient 39 and remainder 1, etc. As a result, constructing a number from division remainders (from right to left), we obtain a number in binary SS: 10011111 . Therefore we can write:

159 10 =10011111 2 .

Example 5 . Let's convert the number 615 from decimal SS to octal SS.

615 8
608 76 8
7 72 9 8
4 8 1
1

When converting a number from a decimal SS to an octal SS, you need to sequentially divide the number by 8 until you get an integer remainder less than 8. As a result, constructing a number from division remainders (from right to left) we get a number in octal SS: 1147 (see Fig. 2). Therefore we can write:

615 10 =1147 8 .

Example 6 . Let's convert the number 19673 from the decimal number system to hexadecimal SS.

19673 16
19664 1229 16
9 1216 76 16
13 64 4
12

As can be seen from Figure 3, by successively dividing the number 19673 by 16, the remainders are 4, 12, 13, 9. In the hexadecimal number system, the number 12 corresponds to C, the number 13 to D. Therefore, our hexadecimal number is 4CD9.

To convert regular decimal fractions (a real number with a zero integer part) into a number system with base s, it is necessary to successively multiply this number by s until the fractional part contains a pure zero, or we obtain the required number of digits. If, during multiplication, a number with an integer part other than zero is obtained, then this integer part is not taken into account (they are sequentially included in the result).

Let's look at the above with examples.

Example 7 . Let's convert the number 0.214 from the decimal number system to binary SS.

0.214
x 2
0 0.428
x 2
0 0.856
x 2
1 0.712
x 2
1 0.424
x 2
0 0.848
x 2
1 0.696
x 2
1 0.392

As can be seen from Fig. 4, the number 0.214 is sequentially multiplied by 2. If the result of multiplication is a number with an integer part other than zero, then the integer part is written separately (to the left of the number), and the number is written with a zero integer part. If the multiplication results in a number with a zero integer part, then a zero is written to the left of it. The multiplication process continues until the fractional part reaches a pure zero or we obtain the required number of digits. Writing bold numbers (Fig. 4) from top to bottom we get the required number in the binary number system: 0. 0011011 .

Therefore we can write:

0.214 10 =0.0011011 2 .

Example 8 . Let's convert the number 0.125 from the decimal number system to binary SS.

0.125
x 2
0 0.25
x 2
0 0.5
x 2
1 0.0

To convert the number 0.125 from decimal SS to binary, this number is sequentially multiplied by 2. In the third stage, the result is 0. Consequently, the following result is obtained:

0.125 10 =0.001 2 .

Example 9 . Let's convert the number 0.214 from the decimal number system to hexadecimal SS.

0.214
x 16
3 0.424
x 16
6 0.784
x 16
12 0.544
x 16
8 0.704
x 16
11 0.264
x 16
4 0.224

Following examples 4 and 5, we get the numbers 3, 6, 12, 8, 11, 4. But in hexadecimal SS, the numbers 12 and 11 correspond to the numbers C and B. Therefore, we have:

0.214 10 =0.36C8B4 16 .

Example 10 . Let's convert the number 0.512 from the decimal number system to octal SS.

0.512
x 8
4 0.096
x 8
0 0.768
x 8
6 0.144
x 8
1 0.152
x 8
1 0.216
x 8
1 0.728

Got:

0.512 10 =0.406111 8 .

Example 11 . Let's convert the number 159.125 from the decimal number system to binary SS. To do this, we translate separately the integer part of the number (Example 4) and the fractional part of the number (Example 8). Further combining these results we get:

159.125 10 =10011111.001 2 .

Example 12 . Let's convert the number 19673.214 from the decimal number system to hexadecimal SS. To do this, we translate separately the integer part of the number (Example 6) and the fractional part of the number (Example 9). Further, combining these results we obtain.

In computer science courses, regardless of school or university, a special place is given to such a concept as number systems. As a rule, several lessons or practical exercises are allocated for it. The main goal is not only to master the basic concepts of the topic, to study the types of number systems, but also to get acquainted with binary, octal and hexadecimal arithmetic.

What does it mean?

Let's start by defining the basic concept. As the textbook "Informatics" notes, a number system is a record of numbers that uses a special alphabet or a specific set of numbers.

Depending on whether the value of a digit changes depending on its position in the number, there are two: positional and non-positional number systems.

In positional systems, the meaning of a digit changes with its position in the number. So, if we take the number 234, then the number 4 in it means units, but if we consider the number 243, then it will already mean tens, not units.

In non-positional systems, the meaning of a digit is static, regardless of its position in the number. The most striking example is the stick system, where each unit is indicated by a dash. It doesn’t matter where you place the stick, the value of the number will only change by one.

Non-positional systems

Non-positional number systems include:

  1. A unit system that is considered one of the first. It used sticks instead of numbers. The more there were, the greater the value of the number. You can find an example of numbers written in this way in films where we are talking about people lost at sea, prisoners who mark each day with the help of notches on a stone or tree.
  2. Roman, in which Latin letters were used instead of numbers. Using them, you can write any number. Moreover, its value was determined using the sum and difference of the digits that made up the number. If there was a smaller number to the left of the digit, then the left digit was subtracted from the right, and if the digit to the right was less than or equal to the digit on the left, then their values ​​were summed. For example, the number 11 was written as XI, and 9 - IX.
  3. Alphabetical, in which numbers were designated using the alphabet of a particular language. One of them is considered to be the Slavic system, in which a number of letters had not only phonetic, but also numerical meaning.
  4. in which only two notations were used for writing - wedges and arrows.
  5. Egypt also used special symbols to represent numbers. When writing a number, each symbol could be used no more than nine times.

Position systems

Much attention is paid in computer science to positional number systems. These include the following:

  • binary;
  • octal;
  • decimal;
  • hexadecimal;
  • sexagesimal, used when counting time (for example, there are 60 seconds in a minute, 60 minutes in an hour).

Each of them has its own alphabet for writing, rules for translation and performing arithmetic operations.

Decimal system

This system is the most familiar to us. It uses the numbers 0 to 9 to write numbers. They are also called Arabic. Depending on the position of the digit in the number, it can denote different digits - units, tens, hundreds, thousands or millions. We use it everywhere, we know the basic rules by which arithmetic operations on numbers are performed.

Binary system

One of the main number systems in computer science is binary. Its simplicity allows the computer to perform cumbersome calculations several times faster than in the decimal system.

To write numbers, only two digits are used - 0 and 1. Moreover, depending on the position of 0 or 1 in the number, its value will change.

Initially, it was with the help of computers that they received all the necessary information. In this case, one meant the presence of a signal transmitted using voltage, and zero meant its absence.

Octal system

Another well-known computer number system, which uses numbers from 0 to 7. It was used mainly in those areas of knowledge that are associated with digital devices. But recently it has been used much less frequently, since it has been replaced by the hexadecimal number system.

Binary decimal system

Representing large numbers in binary is a rather complicated process for humans. To simplify it, it was developed. It is usually used in electronic watches and calculators. In this system, not the entire number is converted from the decimal system to binary, but each digit is converted to its corresponding set of zeros and ones in the binary system. The conversion from binary to decimal occurs in a similar way. Each digit, represented as a four-digit set of zeros and ones, is converted into a decimal number system digit. In principle, there is nothing complicated.

To work with numbers in this case, a table of number systems will be useful, which will indicate the correspondence between the numbers and their binary code.

Hexadecimal system

Recently, the hexadecimal number system has become increasingly popular in programming and computer science. It uses not only numbers from 0 to 9, but also a number of Latin letters - A, B, C, D, E, F.

At the same time, each of the letters has its own meaning, so A=10, B=11, C=12 and so on. Each number is represented as a set of four characters: 001F.

Converting numbers: from decimal to binary

Translation in number systems occurs according to certain rules. The most common conversion is from binary to decimal system and vice versa.

In order to convert a number from the decimal system to the binary system, it is necessary to sequentially divide it by the base of the number system, that is, the number two. In this case, the remainder of each division must be recorded. This will happen until the remainder of the division is less than or equal to one. It is best to carry out calculations in a column. The resulting division remainders are then written to the line in reverse order.

For example, let's convert the number 9 to binary:

We divide 9, since the number is not divisible by a whole, then we take the number 8, the remainder will be 9 - 1 = 1.

After dividing 8 by 2, we get 4. Divide it again, since the number is divisible by an integer - we get a remainder of 4 - 4 = 0.

We carry out the same operation with 2. The remainder is 0.

As a result of division we get 1.

Regardless of the final number system, the conversion of numbers from decimal to any other will occur according to the principle of dividing the number by the base of the positional system.

Converting numbers: from binary to decimal

It is quite easy to convert numbers into the decimal number system from binary. To do this, it is enough to know the rules for raising numbers to powers. In this case, to the power of two.

The translation algorithm is as follows: each digit from the code of a binary number must be multiplied by two, and the first two will be to the power of m-1, the second - m-2 and so on, where m is the number of digits in the code. Then add the results of the addition to obtain an integer.

For schoolchildren, this algorithm can be explained more simply:

To begin with, we take and write down each digit multiplied by two, then put the power of two from the end, starting from zero. Then we add up the resulting number.

As an example, we will analyze the number 1001 obtained earlier, converting it to the decimal system, and at the same time check the correctness of our calculations.

It will look like this:

1*2 3 + 0*2 2 +0*2 1 +1*2 0 = 8+0+0+1 =9.

When studying this topic, it is convenient to use a table with powers of two. This will significantly reduce the amount of time required to carry out calculations.

Other translation options

In some cases, translation can be carried out between binary and octal number systems, binary and hexadecimal. In this case, you can use special tables or launch a calculator application on your computer by selecting the “Programmer” option in the View tab.

Arithmetic operations

Regardless of the form in which the number is presented, it can be used to carry out calculations that are familiar to us. This can be division and multiplication, subtraction and addition in the number system you have chosen. Of course, each of them has its own rules.

So for the binary system, its own tables have been developed for each of the operations. The same tables are used in other positional systems.

There is no need to memorize them - just print them out and have them on hand. You can also use a calculator on your PC.

One of the most important topics in computer science is the number system. Knowledge of this topic, understanding of algorithms for converting numbers from one system to another is the key to the fact that you will be able to understand more complex topics, such as algorithmization and programming, and will be able to write your first program yourself.

Purpose of the service. The service is designed to convert numbers from one number system to another online. To do this, select the base of the system from which you want to convert the number. You can enter both integers and numbers with commas.

You can enter both whole numbers, for example 34, and fractional numbers, for example, 637.333. For fractional numbers, the translation accuracy after the decimal point is indicated.

The following are also used with this calculator:

Ways to represent numbers

Binary (binary) numbers - each digit means the value of one bit (0 or 1), the most significant bit is always written on the left, the letter “b” is placed after the number. For ease of perception, notebooks can be separated by spaces. For example, 1010 0101b.
Hexadecimal (hexadecimal) numbers - each tetrad is represented by one symbol 0...9, A, B, ..., F. This representation can be designated in different ways; here only the symbol “h” is used after the last hexadecimal digit. For example, A5h. In program texts, the same number can be designated as either 0xA5 or 0A5h, depending on the syntax of the programming language. A leading zero (0) is added to the left of the most significant hexadecimal digit represented by the letter to distinguish between numbers and symbolic names.
Decimal (decimal) numbers - each byte (word, double word) is represented by a regular number, and the decimal representation sign (the letter “d”) is usually omitted. The byte in the previous examples has a decimal value of 165. Unlike binary and hexadecimal notation, decimal is difficult to mentally determine the value of each bit, which is sometimes necessary.
Octal (octal) numbers - each triple of bits (division starts from the least significant) is written as a number 0–7, with an “o” at the end. The same number would be written as 245o. The octal system is inconvenient because the byte cannot be divided equally.

Algorithm for converting numbers from one number system to another

Converting whole decimal numbers to any other number system is carried out by dividing the number by the base of the new number system until the remainder remains a number less than the base of the new number system. The new number is written as division remainders, starting from the last one.
Converting a regular decimal fraction to another PSS is carried out by multiplying only the fractional part of the number by the base of the new number system until all zeros remain in the fractional part or until the specified translation accuracy is achieved. As a result of each multiplication operation, one digit of a new number is formed, starting with the highest one.
Improper fraction translation is carried out according to rules 1 and 2. The integer and fractional parts are written together, separated by a comma.

Example No. 1.



Conversion from 2 to 8 to 16 number system.
These systems are multiples of two, therefore the translation is carried out using a correspondence table (see below).

To convert a number from the binary number system to the octal (hexadecimal) number system, it is necessary to divide the binary number from the decimal point to the right and left into groups of three (four for hexadecimal) digits, supplementing the outer groups with zeros if necessary. Each group is replaced by the corresponding octal or hexadecimal digit.

Example No. 2. 1010111010.1011 = 1.010.111.010.101.1 = 1272.51 8
here 001=1; 010=2; 111=7; 010=2; 101=5; 001=1

When converting to the hexadecimal system, you must divide the number into parts of four digits, following the same rules.
Example No. 3. 1010111010,1011 = 10.1011.1010,1011 = 2B12,13 HEX
here 0010=2; 1011=B; 1010=12; 1011=13

Converting numbers from 2, 8 and 16 to the decimal number system is done by breaking the number into separate ones and multiplying it by the base of the system (from which the number is translated) raised to the power corresponding to its serial number in the number being converted. In this case, the numbers are numbered to the left of the decimal point (the first number is numbered 0) with increasing, and to the right with decreasing (i.e., with a negative sign). The results obtained are added up.

Example No. 4.
An example of conversion from binary to decimal number system.

1010010.101 2 = 1·2 6 +0·2 5 +1·2 4 +0·2 3 +0·2 2 +1·2 1 +0·2 0 + 1·2 -1 +0·2 - 2 +1 2 -3 =
= 64+0+16+0+0+2+0+0.5+0+0.125 = 82.625 10 An example of conversion from octal to decimal number system. 108.5 8 = 1*·8 2 +0·8 1 +8·8 0 + 5·8 -1 = 64+0+8+0.625 = 72.625 10 An example of conversion from hexadecimal to decimal number system. 108.5 16 = 1·16 2 +0·16 1 +8·16 0 + 5·16 -1 = 256+0+8+0.3125 = 264.3125 10

Once again we repeat the algorithm for converting numbers from one number system to another PSS

  1. From the decimal number system:
    • divide the number by the base of the number system being translated;
    • find the remainder when dividing an integer part of a number;
    • write down all remainders from division in reverse order;
  2. From the binary number system
    • To convert to the decimal number system, it is necessary to find the sum of the products of base 2 by the corresponding degree of digit;
    • To convert a number to octal, you need to break the number into triads.
      For example, 1000110 = 1,000 110 = 106 8
    • To convert a number from binary to hexadecimal, you need to divide the number into groups of 4 digits.
      For example, 1000110 = 100 0110 = 46 16
The system is called positional, for which the significance or weight of a digit depends on its location in the number. The relationship between the systems is expressed in a table.
Number system correspondence table:
Binary SSHexadecimal SS
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

Table for conversion to octal number system

Example No. 2. Convert the number 100.12 from the decimal number system to the octal number system and vice versa. Explain the reasons for the discrepancies.
Solution.
Stage 1. .

We write the remainder of the division in reverse order. We get the number in the 8th number system: 144
100 = 144 8

To convert the fractional part of a number, we sequentially multiply the fractional part by base 8. As a result, each time we write down the whole part of the product.
0.12*8 = 0.96 (integer part 0 )
0.96*8 = 7.68 (integer part 7 )
0.68*8 = 5.44 (integer part 5 )
0.44*8 = 3.52 (integer part 3 )
We get the number in the 8th number system: 0753.
0.12 = 0.753 8

100,12 10 = 144,0753 8

Stage 2 Converting a number from the decimal number system to the octal number system.
Reverse conversion from octal number system to decimal.

To translate an integer part, you need to multiply the digit of a number by the corresponding degree of digit.
144 = 8 2 *1 + 8 1 *4 + 8 0 *4 = 64 + 32 + 4 = 100

To convert the fractional part, you need to divide the digit of the number by the corresponding degree of digit
0753 = 8 -1 *0 + 8 -2 *7 + 8 -3 *5 + 8 -4 *3 = 0.119873046875 = 0.1199

144,0753 8 = 100,96 10
The difference of 0.0001 (100.12 - 100.1199) is explained by a rounding error when converting to the octal number system. This error can be reduced if you take a larger number of digits (for example, not 4, but 8).

To represent numbers in a microprocessor it is used binary number system.
In this case, any digital signal can have two stable states: “high level” and “low level”. In the binary number system, two digits are used to represent any number, respectively: 0 and 1. Arbitrary number x=a n a n-1 ..a 1 a 0 ,a -1 a -2 …a -m will be written in binary number system as

x = a n ·2 n +a n-1 ·2 n-1 +…+a 1 ·2 1 +a 0 ·2 0 +a -1 ·2 -1 +a -2 ·2 -2 +…+a -m ·2 -m

Where a i— binary digits (0 or 1).

Octal number system

In the octal number system, the base digits are the numbers from 0 to 7. 8 low-order ones are combined into a high-order one.

Hexadecimal number system

In the hexadecimal number system, the base digits are the numbers from 0 to 15 inclusive. To designate base digits greater than 9 with one symbol, in addition to the Arabic numerals 0...9 in the hexadecimal number system, letters of the Latin alphabet are used:

10 10 = A 16 12 10 = C 16 14 10 = E 16
11 10 = B 16 13 10 = D 16 15 10 = F 16.

For example, the number 175 10 in hexadecimal number system will be written as AF 16. Really,

10·16 1 +15·16 0 =160+15=175

The table shows numbers from 0 to 16 in decimal, binary, octal and hexadecimal number systems.

Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10

Binary-octal and binary-hexadecimal conversions

The binary number system is convenient for performing arithmetic operations using microprocessor hardware, but is inconvenient for human perception because it requires a large number of digits. Therefore, in computer technology, in addition to the binary number system, octal and hexadecimal number systems have been widely used for a more compact representation of numbers.

The three digits of the octal number system implement all possible combinations of octal digits in the binary number system: from 0 (000) to 7 (111). To convert a binary number to octal, you need to combine the binary digits into groups of 3 digits (triads) in two directions, starting from the decimal separator. If necessary, you need to add insignificant zeros to the left of the original number. If a number contains a fractional part, then to the right of it you can also add insignificant zeros until all triads are filled. Each triad is then replaced by an octal digit.

Example: Convert the number 1101110.01 2 to octal number system.

We combine binary digits into triads from right to left. We get

001 101 110,010 2 = 156,2 8 .

To convert a number from octal to binary, you need to write each octal digit in binary code:

156,2 8 = 001 101 110,010 2 .

The four digits of the hexadecimal number system implement all possible combinations of hexadecimal digits in the binary number system: from 0 (0000) to F(1111). To convert a binary number to hexadecimal, you need to combine the binary digits into groups of 4 digits (tetrads) in two directions, starting from the decimal separator. If necessary, you need to add insignificant zeros to the left of the original number. If the number contains a fractional part, then to the right of it you also need to add insignificant zeros until all notebooks are filled. Each tetrad is then replaced with a hexadecimal digit.

Example: Convert the number 1101110.11 2 to hexadecimal number system.

We combine binary digits into tetrads from right to left. We get

0110 1110.1100 2 = 6E,C 16 .

To convert a number from hexadecimal to binary, you need to write each hexadecimal digit in binary code.

ABSTRACT ON THE FUNDAMENTALS OF COMPUTER SCIENCE THEORY

Subject:Octal and hexadecimal number systems.

Converting integers from one number system to another.

Imashev Ilnar Aidarovich

specialty 230701

Applied Informatics

course 2, group PI-2

Full-time form of education

Supervisor:

Kalashnikova Anastasia Nikolaevna

Introduction.............................................................................................................. 3

1. Octal number system.................................................... .......................... 5

2. Hexadecimal number system.................................................... ................ 7

3. Converting numbers from one number system to another.................................................... 9

Conclusion...................................................................................................... 11

Bibliography......................................................................................... 12

Application


INTRODUCTION

At the early stages of the development of society, people almost did not know how to count. They distinguished collections of two and three objects from each other; any collection containing a larger number of objects was united in the concept “many”. This was not yet an account, but only its embryo.

Subsequently, the ability to distinguish small aggregates from each other developed; Words arose to denote the concepts “four”, “five”, “six”, “seven”. The last word also meant an indefinitely large quantity for a long time. Our proverbs have preserved the memory of this era (“measure seven times - cut once”, “seven nannies have a child without an eye”, “seven troubles - one answer”, etc.).

A particularly important role was played by man’s natural instrument – ​​his fingers. This instrument could not store the calculation result for a long time, but it was always “at hand” and was distinguished by great mobility. The language of primitive man was poor; gestures compensated for the lack of words, and numbers for which there were no names were “showed” on the fingers.

Therefore, it is quite natural that the newly emerging names of “large” numbers were often based on the number 10 - according to the number of fingers on the hands.

At first, the expansion of the stock of numbers was slow. At first, people mastered counting within a few tens and only later reached a hundred. For many peoples, the number 40 has long been the limit of counting and the name of an indefinitely large number. In Russian, the word “centipede” has the meaning “centipede”; The expression “forty forty” meant in the old days a number that surpassed all imagination.

At the next stage, counting reaches a new limit: ten tens, and a name is created for the number 100. At the same time, the word “hundred” takes on the meaning of an indefinitely large number. The numbers one thousand, ten thousand (in the old days this number was called “darkness”), and a million subsequently acquire the same meaning.

At the present stage, the boundaries of counting are defined by the term “infinity,” which does not denote any specific number.

Modern man constantly encounters numbers and numbers in everyday life - they are with us everywhere. Various number systems are used whenever there is a need for numerical calculations, from pencil-on-paper calculations by elementary school students to calculations performed on supercomputers. Therefore, this topic is very interesting to me, and I wanted to learn more about it.


Octal number system

Octal number system- a positional integer number system with base 8. It uses numbers from 0 to 7 to represent numbers.

The octal system is often used in areas related to digital devices. It is characterized by easy conversion of octal numbers to binary and vice versa, by replacing octal numbers with binary triplets. Previously, it was widely used in programming and computer documentation in general, but has now been almost completely replaced by hexadecimal.

Octal to binary conversion table

To convert an octal number to binary, you need to replace each digit of the octal number with a triplet of binary digits. For example: 2541 8 = [ 2 8 | 5 8 | 4 8 | 1 8 ] = [ 010 2 | 101 2 | 100 2 | 001 2 ] = 010101100001 2
In programming, the prefix 0 (zero) is used to explicitly indicate an octal number. For example: 022.

This number system has 8 digits: 0, 1, 2, 3, 4, 5, 6, 7. To convert, for example, the number 611 (octal), to the binary system, you need to replace each digit with its equivalent binary triad (three digits). It is easy to guess that to convert a multi-digit binary number into the octal system, you need to break it into triads from right to left and replace each triad with the corresponding octal digit.

6118 =011 001 0012

1 110 011 1012=14358 (4 triads)

To convert a binary number to octal, it is enough to break it into triplets and replace them with their corresponding digits from the octal number system. You need to start dividing into triplets from the end, and replace the missing numbers at the beginning with zeros. For example:

1011101 = 1 011 101 = 001 011 101 = 1 3 5 = 135

That is, the number 1011101 in the binary number system is equal to the number 135 in the octal number system. Or 1011101 2 = 135 8.

Reverse translation. Let's say you need to convert the number 100 8 (don't be mistaken! 100 in octal is not 100 in decimal) into the binary number system.

100 8 = 1 0 0 = 001 000 000 = 001000000 = 1000000 2

Converting an octal number to a decimal number can be done using the already familiar scheme:

672 8 = 6 * 8 2 + 7 * 8 1 + 2 * 8 0 = 6 * 64 + 56 + 2 = 384 + 56 + 2 = 442 10
100 8 = 1 * 8 2 + 0 * 8 1 + 0 * 8 0 = 64 10 .
2. Hexadecimal number system

Hexadecimal number system (hexadecimal numbers) - positional number system based on integer base 16.

Usually as hexadecimal digits decimal digits from 0 to 9 and Latin letters from A to F are used to represent numbers from 10 10 to 15 10, that is, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B , C, D, E, F).

Application:

Widely used in low-level programming and computer documentation, since in modern computers the minimum unit of memory is an 8-bit byte, the values ​​of which are conveniently written in two hexadecimal digits. This use began with the IBM/360 system, where all documentation used the hexadecimal system, while the documentation of other computer systems of the time (even with 8-bit characters, such as the PDP-11 or BESM-6) used the octal system .

In the Unicode standard, the character number is usually written in hexadecimal, using at least 4 digits (with leading zeros if necessary).

Hexadecimal color - recording the three components of color (R, G and B) in hexadecimal form.

When converting a binary number to hexadecimal, the first is divided into groups of four digits, starting from the end. If the number of digits is not divisible by an integer, then the first four is appended with zeros in front. Each four corresponds to a digit in the hexadecimal number system:

For example:
10001100101 = 0100 1100 0101 = 4 C 5 = 4C5

If necessary, the number 4C5 can be converted to the decimal number system as follows (C should be replaced with the number corresponding to this symbol in the decimal number system - this is 12):

4C5 = 4 * 16 2 + 12 * 16 1 + 5 * 16 0 = 4 * 256 + 192 + 5 = 1221

The maximum two-digit number that can be obtained using hexadecimal notation is FF.

FF = 15 * 16 1 + 15 * 16 0 = 240 + 15 = 255