Find the base of the number system. Converting numbers to binary, hexadecimal, decimal, octal number systems

Notation is a method of writing a number using a specified set of special characters (numbers).

Notation:

  • gives a representation of a set of numbers (integer and/or real);
  • gives each number a unique representation (or at least a standard representation);
  • displays the algebraic and arithmetic structure of a number.

Writing a number in some number system is called number code.

A single position in the display of a number is called discharge, so the position number is rank number.

The number of digits in a number is called bit depth and matches its length.

Number systems are divided into positional And non-positional. Positional number systems are divided

on homogeneous And mixed.

octal number system, hexadecimal number system and other number systems.

Translation of number systems. Numbers can be converted from one number system to another.

Correspondence table of numbers in various number systems.

Service assignment. The service is designed to translate numbers from one number system to another online. To do this, select the base of the system from which you want to translate the number. You can enter both integers and numbers with a comma.

You can enter either whole numbers, such as 34 , or fractional numbers, such as 637.333 . For fractional numbers, the accuracy of the translation 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 character 0...9, A, B, ..., F. Such a representation can be denoted in different ways, here only the character "h" is used after the last hexadecimal digit. For example, A5h. In program texts, the same number can be denoted both as 0xA5 and 0A5h, depending on the syntax of the programming language. A non-significant zero (0) is added to the left of the most significant hexadecimal digit represented by a letter to distinguish between numbers and symbolic names.
Decimals (decimal) numbers - each byte (word, double word) is represented by an ordinary number, and the sign of the decimal representation (letter "d") is usually omitted. The byte from 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 sometimes has to be done.
Octal (octal) numbers - each triple of bits (separation starts from the least significant) is written as a number 0-7, at the end the sign "o" is put. The same number would be written as 245o. The octal system is inconvenient in that the byte cannot be divided equally.

Algorithm for converting numbers from one number system to another

The conversion of integer 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 leaves a number less than the base of the new number system. The new number is written as the remainder of the division, starting with the last one.
The conversion of the correct 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 reached. As a result of each multiplication operation, one digit of the new number is formed, starting from the highest.
The translation of an improper fraction is carried out according to the 1st and 2nd rules. The integer and fractional parts are written together, separated by a comma.

Example #1.



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

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

Example #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 hexadecimal, you must divide the number into parts, four digits each, following the same rules.
Example #3. 1010111010.1011 = 10.1011.1010.1011 = 2B12.13 HEX
here 0010=2; 1011=B; 1010=12; 1011=13

The conversion of numbers from 2, 8 and 16 to the decimal system is carried out 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 ordinal number in the translated number. In this case, the numbers are numbered to the left of the comma (the first number has the number 0) with increasing, and in right side descending (i.e. from negative sign). The results obtained are added up.

Example #4.
Example of converting 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 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 converting 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 translating 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 after dividing the integer part of the number;
    • write down all remainders from division in reverse order;
  2. From the binary system
    • To convert to the decimal number system, you need to find the sum of the products of base 2 by the corresponding degree of discharge;
    • To convert a number to octal, you need to break the number into triads.
      For example, 1000110 = 1000 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 systems is expressed in a table.
Table of correspondence of number systems:
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 converting to octal number system

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

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

To translate the fractional part of a number, we successively multiply the fractional part by base 8. As a result, each time we write down the integer part of the product.
0.12*8 = 0.96 (whole part 0 )
0.96*8 = 7.68 (whole part 7 )
0.68*8 = 5.44 (whole part 5 )
0.44*8 = 3.52 (whole 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 decimal to octal.
Reverse conversion from octal to decimal.

To translate the integer part, it is necessary to multiply the digit of the number by the corresponding degree of digit.
144 = 8 2 *1 + 8 1 *4 + 8 0 *4 = 64 + 32 + 4 = 100

To translate the fractional part, it is necessary 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 due to a rounding error when converting to octal. This error can be reduced if we take a larger number of digits (for example, not 4, but 8).

Before we start solving problems, we need to understand a few simple points.

Consider the decimal number 875. The last digit of the number (5) is the remainder of the division of the number 875 by 10. The last two digits form the number 75 - this is the remainder of the division of the number 875 by 100. Similar statements are true for any number system:

The last digit of a number is the remainder of dividing that number by the base of the number system.

The last two digits of a number are the remainder of dividing the number by the base of the squared number system.

For example, . We divide 23 by the base of system 3, we get 7 and 2 in the remainder (2 is the last digit of the number in the ternary system). Divide 23 by 9 (base squared), we get 18 and 5 in the remainder (5 = ).

Let's go back to the usual decimal system. Number = 100000. 10 to the power of k is one and k zeros.

A similar statement is true for any number system:

The base of the number system to the power of k in this number system is written as a unit and k zeros.

For example, .

1. Search for the base of the number system

Example 1

In a number system with some base, the decimal number 27 is written as 30. Specify this base.

Solution:

Denote the required base x. Then .i.e. x=9.

Example 2

In a number system with some base, the decimal number 13 is written as 111. Specify this base.

Solution:

Denote the required base x. Then

We solve the quadratic equation, we get the roots 3 and -4. Since the base of the number system cannot be negative, the answer is 3.

Answer: 3

Example 3

Indicate, separated by commas, in ascending order, all the bases of the number systems in which the entry of the number 29 ends in 5.

Solution:

If in some system the number 29 ends in 5, then the number reduced by 5 (29-5=24) ends in 0. We have already said that the number ends in 0 when it is divisible without remainder by the base of the system. Those. we need to find all such numbers that are divisors of the number 24. These numbers are: 2, 3, 4, 6, 8, 12, 24. Note that in the number systems with base 2, 3, 4 there is no number 5 (and in the formulation problem, the number 29 ends in 5), so there are systems with bases: 6, 8, 12,

Answer: 6, 8, 12, 24

Example 4

Indicate, separated by commas, in ascending order, all the bases of the number systems in which the entry of the number 71 ends in 13.

Solution:

If in some system the number ends in 13, then the base of this system is at least 4 (otherwise there is no number 3).

A number reduced by 3 (71-3=68) ends in 10. That is, 68 is completely divisible by the required base of the system, and the quotient of this, when divided by the base of the system, gives a remainder of 0.

Let's write out all the integer divisors of the number 68: 2, 4, 17, 34, 68.

2 is not suitable, because the base is not less than 4. Check the rest of the divisors:

68:4 = 17; 17:4 \u003d 4 (rest 1) - suitable

68:17 = 4; 4:17 = 0 (rest 4) - not suitable

68:34 = 2; 2:17 = 0 (rest 2) - not suitable

68:68 = 1; 1:68 = 0 (rest 1) - suitable

Answer: 4, 68

2. Search for numbers by conditions

Example 5

Indicate, separated by a comma, in ascending order, all decimal numbers not exceeding 25, the notation of which in the base four number system ends in 11?

Solution:

First, let's find out what the number 25 looks like in a number system with base 4.

Those. we need to find all numbers, not greater than , whose notation ends with 11. By the rule of sequential counting in a system with base 4,
we get numbers and . We translate them into the decimal number system:

Answer: 5, 21

3. Solution of equations

Example 6

Solve the equation:

Write down the answer in ternary system (the base of the number system in the answer is not necessary to write).

Solution:

Let's convert all the numbers to the decimal number system:

The quadratic equation has roots -8 and 6. (because the base of the system cannot be negative). .

Answer: 20

4. Counting the number of ones (zeros) in the binary notation of the value of the expression

To solve this type of problem, we need to remember how addition and subtraction "in a column" works:

When adding, the bitwise summation of the digits written one under the other occurs, starting from the least significant digits. If the resulting sum of two digits is greater than or equal to the base of the number system, the remainder of dividing this amount by the base of the system is written under the summed figures, and the integer part of dividing this amount by the base of the system is added to the sum of the following digits.

When subtracting, a bit-by-bit subtraction of the digits written one under the other occurs, starting from the least significant digits. If the first digit is less than the second, we “borrow” one from the adjacent (larger) digit. The unit occupied in the current digit is equal to the base of the number system. In decimal it's 10, in binary it's 2, in ternary it's 3, and so on.

Example 7

How many units are contained in the binary notation of the value of the expression: ?

Solution:

Let's represent all the numbers of the expression as powers of two:

In binary notation, two to the power of n looks like 1 followed by n zeros. Then summing and , we get a number containing 2 units:

Now subtract 10000 from the resulting number. According to the rules of subtraction, we borrow from the next digit.

Now add 1 to the resulting number:

We see that the result has 2013+1+1=2015 units.

The calculator allows you to convert whole and fractional numbers from one number system to another. The base of the number system cannot be less than 2 and more than 36 (10 digits and 26 Latin letters, after all). Numbers must not exceed 30 characters. To enter fractional numbers, use the symbol. or, . To convert a number from one system to another, enter the original number in the first field, the base of the original number system in the second, and the base of the number system to which you want to convert the number in the third field, then click the "Get Entry" button.

original number recorded in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 -th number system.

I want to get a record of a number in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 -th number system.

Get an entry

Translations completed: 3722471

It may also be of interest:

  • Truth table calculator. SDNF. SKNF. Zhegalkin polynomial

Number systems

Number systems are divided into two types: positional And not positional. We use the Arabic system, it is positional, and there is also the Roman one - it is just not positional. IN positional systems The position of a digit in a number uniquely determines the value of that number. This is easy to understand by looking at the example of some number.

Example 1. Let's take the number 5921 in the decimal number system. We number the number from right to left starting from zero:

The number 5921 can be written in the following form: 5921 = 5000+900+20+1 = 5 10 3 +9 10 2 +2 10 1 +1 10 0 . The number 10 is a characteristic that defines the number system. The values ​​of the position of the given number are taken as degrees.

Example 2. Consider the real decimal number 1234.567. We number it starting from the zero position of the number from the decimal point to the left and to the right:

The number 1234.567 can be written as follows: 1234.567 = 1000+200+30+4+0.5+0.06+0.007 = 1 10 3 +2 10 2 +3 10 1 +4 10 0 +5 10 -1 + 6 10 -2 +7 10 -3 .

Converting numbers from one number system to another

Most in a simple way transferring a number from one number system to another is the translation of the number first into the decimal number system, and then, the result obtained into the required number system.

Converting numbers from any number system to decimal number system

To convert a number from any number system to decimal, it is enough to number its digits, starting from zero (the digit to the left of the decimal point) similarly to examples 1 or 2. Let's find the sum of the products of the digits of the number by the base of the number system to the power of the position of this digit:

1. Convert number 1001101.1101 2 to decimal number system.
Solution: 10011.1101 2 = 1 2 4 +0 2 3 +0 2 2 +1 2 1 +1 2 0 +1 2 -1 +1 2 -2 +0 2 -3 +1 2 - 4 = 16+2+1+0.5+0.25+0.0625 = 19.8125 10
Answer: 10011.1101 2 = 19.8125 10

2. Convert number E8F.2D 16 to decimal number system.
Solution: E8F.2D 16 = 14 16 2 +8 16 1 +15 16 0 +2 16 -1 +13 16 -2 = 3584+128+15+0.125+0.05078125 = 3727.17578125 10
Answer: E8F.2D 16 = 3727.17578125 10

Converting numbers from a decimal number system to another number system

To convert numbers from a decimal number system to another number system, the integer and fractional parts of the number must be translated separately.

Converting the integer part of a number from a decimal number system to another number system

The integer part is translated from the decimal number system to another number system by successively dividing the integer part of the number by the base of the number system until an integer remainder is obtained, less than the base of the number system. The result of the transfer will be a record from the remains, starting with the last one.

3. Convert number 273 10 to octal number system.
Solution: 273 / 8 = 34 and remainder 1, 34 / 8 = 4 and remainder 2, 4 is less than 8, so the calculation is complete. The record from the remnants will look like this: 421
Examination: 4 8 2 +2 8 1 +1 8 0 = 256+16+1 = 273 = 273 , the result is the same. So the translation is correct.
Answer: 273 10 = 421 8

Let's consider the translation of correct decimal fractions into various number systems.

Converting the fractional part of a number from a decimal number system to another number system

Recall that a proper decimal fraction is real number with zero integer part. To translate such a number into a number system with base N, you need to consistently multiply the number by N until the fractional part is zeroed or the required number of digits is obtained. If during multiplication a number with an integer part other than zero is obtained, then the integer part is not taken into account further, since it is sequentially entered into the result.

4. Convert number 0.125 10 to binary number system.
Solution: 0.125 2 = 0.25 (0 is the integer part, which will be the first digit of the result), 0.25 2 = 0.5 (0 is the second digit of the result), 0.5 2 = 1.0 (1 is the third digit of the result, and since the fractional part is zero , the translation is complete).
Answer: 0.125 10 = 0.001 2

C - to dream