The number system is ternary - a table. How to translate into a ternary number system

In computer science, in addition to the familiar decimal number system, there are various options for integer positional systems. One of these is the ternary.

What are the number systems

In ordinary life, people use the decimal number system, which includes numbers from 0 to 9. In computer science, it is customary to use a binary system that includes only 0 and 1. However, this does not interfere with other systems, such as ternary, which consists of the numbers 0,1 and 2 It is less popular than the ones mentioned above, however, an understanding of how to translate into the ternary number system will be useful to students of computer science. The article provides simple translation examples.

How to translate to the ternary number system from decimal

This translation method is very simple and similar to binary conversion. It is necessary to take a decimal number, and divide by the base of the system (in the ternary - the number 3), until the remainder is a number less than three. Then all residuals are written in reverse order.

ternary number system

The same method is suitable for most number systems. Difficulties can arise with the hexadecimal system, in which numbers from 10 to 15 are indicated by the first letters of the English alphabet. For ease of calculation, you can divide the number in a column. This is more convenient than writing to a line, because it will not let you get confused and miss values.

Translation example

As an example of how to translate into the ternary number system, you can use the number 100. To begin, write down the number and divide it by 3. It turns out: 100/3 = 33 (remainder 1) / 3 = 11 (remainder 0) / 3 = 3 (residue 2) / 3 = 1 (residue 0). Then you should write out all the numbers: 10201. Write the number the other way around (from the last digit to the first). In this example, the same number will be obtained, but there may be a different number, like 22102, which will be written as 20122.

Decimal to decimal conversion

How to translate the ternary number system into decimal? Requires basic skills of addition, multiplication and exponentiation. First you need to write down the translated ternary number and write a serial number above each digit (starting from the last, which has the number 0, to the first, in ascending order by one).

numbering in the ternary system

Then it is necessary to multiply each number by the base of the numerical system (in this case, the triple), while the number 3 will be raised to the power equal to the serial number of that number by which it is multiplied. All zeros can be omitted (such a multiplication does not make sense in this case), while a number should also be written over them to prevent confusion. Then all the obtained values ​​are added up, and the final number will be the answer.

Translation example

For an example of how the numeration of numbers in the ternary system can be returned to decimal, we use the previously named number 20122. For a start, indicate its serial number above each digit 2 4 0 3 1 2 2 1 2 0 . Then each number should be multiplied by the base of the ternary system, which is raised to a power by the number number: 2 * 3 4 + 1 * 3 2 + 2 * 3 1 + 2 * 3 0 . The results are summarized (162 + 9 + 6 + 2). The result will be the number 179. At the same time, you can notice that the number 0 was not written. If desired, it can also be taken into account, but it will only give a zero result.

How to easily translate numbers from different systems

If this method of calculation seems too long, then you can always use online calculators. A large number of modern services work with the ternary system and many others. Along with this, you can see how the translation to the ternary number system was performed and remember how to correctly read or check for errors.

translation to the ternary number system

At the same time, one should not forget about teaching aids. The need for translation into different number systems often arises among schoolchildren and students who study computer science. Most textbooks contain a section with translation values. Also for university students there are many reference books with a huge amount of data, including the ternary number system, translation rules and basic integer values.

What to do with fractional expressions

Working with such numbers is also possible. The translation method is similar to that described earlier, however, it is necessary to consider individual details. In the translation process, the fractional number is also divided by 3, however, if the result is not integer, for example, 1,236. In this case, only the number before the decimal point is written (even 0 is taken into account). Then, the resulting numbers are written after the decimal point in the new number system, for example, 0.21022 in the ternary system.

how to translate into the ternary number system

If the expression itself has both an integer and a fractional part, then it is worth performing separate translations. First, take the integer part and share it in the described way, then calculate the fractional part, and write it after the decimal point.

Negative Number Translation

In the case of the ternary number system, working with negative numbers is simple. When translating a negative decimal into a ternary, the signs are preserved.

However, this does not work correctly on the binary system, where the procedure will be more time consuming. In this regard, it is not so easy to convert a decimal negative number to binary, as is the case with the ternary number system.

how to translate into a ternary number system

Variants of the ternary number system

Unlike other systems, the ternary can be asymmetric and symmetrical. In all previous versions, the first, asymmetric system was described. The differences are very noticeable. In a symmetric system, the signs (-; 0+), (-1; 0 + 1) are used. A variant with an upper or lower underline of a nonzero number is possible, to indicate a minus. This option is not so often found in the school curriculum, but it must be taken into account, because it is quite easy to confuse with the binary system. However, the latter has no signs before the number.

Also noteworthy is the designation of the ternary system with letters. Usually it is A, B, C, and it is indicated which number is larger and smaller (A> B> C).

Table

It will not be superfluous to mention the basic meanings of the conversion from decimal to ternary. Although it is quite simple, but at the initial stages of the calculation, it is worth checking the result obtained before undertaking more serious calculations. The ternary number system and the table will help to understand what the translation of different systems is based on.

ternary number system table

From this table, the logic by which numbers are formed becomes clear. It is also quite simple to remember.

There are several different number systems. In everyday life, a person only has to deal with a decimal, but you should know that there is a ternary number system. It differs from the rest by the presence of three digits and two recording options (symmetric and asymmetric). At the same time, it is quite simple to work with negative and fractional numbers in it. Due to this, this system is very easy to understand. The symmetric option may resemble a binary system, however, there is a significant difference between them. It consists in the presence of signs that distinguish a positive number from a negative. There are none in the binary system.

Source: https://habr.com/ru/post/C49526/


All Articles