Use different number systems. Number Systems Basics

Number systems. The concept of number systems. Types and groups of number systems

The number system (SS) is a rule for recording a number using a given set of special characters - numbers. There are several groups of recording numbers: Unary. This is an SS in which one sign is used to write numbers - (stick). The next number is obtained from the previous one by adding a new one - one, their number is equal to the number itself. To write a number in the unary system, use the notation Z1. Non-positional SS (the most common is the Roman). In it, some basic numbers are represented in capital Latin letters: 1-I 5-V, ​​10-X, 50-L, 100-C, 500-D, 1000-M. If the smaller number is to the right of the larger number, then their values are summed up, if on the left, the smaller value is subtracted from the larger one. The numbers I, X, C, M can appear in a row no more than three times. The numbers V, L, D can be used in writing a number no more than once. Positional SS - SS, in which the value of each digit in the image of a number is determined by its position (position) in a series of other digits. What the unary and Roman SS have in common is that the value of a number is determined through the operations of addition and subtraction of the base digits that make up the number, regardless of their position in the number. Such systems are called additive. In contrast, positional SS are considered additive-multiplicative, because the value of a number is determined by the operations of multiplication and addition.

Converting whole and fractional numbers from one number system to another

Since the same number can be written in different SS, it is possible to convert a number from one system to another. Because Since the most common SS is decimal, it is necessary to consider algorithms for converting from a decimal system to another and back. Algorithm for converting from decimal SS to another. 1). Divide the original number Z(10) integer by the base of the new system (p) and find the remainder of the separation - this will be the digit from the 0th digit of the number Z. 2). Divide the quotient of the division again by P, isolating the remainder; continue the procedure until the quotient is less than P. 3). The resulting division residues, placed in the reverse order of their receipt, represent Z(p). Algorithm for converting Z(p) to Z(10). For this transformation, formula (1) is used: Z p =a k-1 *p k-1 +a k-2 *p k-2 + … +a 1 *p 1 +a 0 *p 0 ; (1) Where p is the base SS, k is the total number of digits of the number. For example: 443 (5)=4*5 2 + 4*5 1 + 3*5 0 = 100+20+3 = 123. Algorithm for converting a fractional number from decimal SS to another system. Multiply the original fraction in the 10th system by the base P, select the whole part - it will be the first digit of the new fraction, discard the whole part. For the remaining fractional part, repeat the multiplication operation, separating the integer and fractional parts, until the fractional part contains 0 or the desired accuracy of the final number is achieved. Write the fraction as a sequence of numbers after the delimited field in the order they appear. Example: 0.375 (10) at 0, Y(2). 0.375*2 = |0.|750 0.75*2 = |1.|50 0.5*2 = |1.|0 0.375 10 = 0.011 2 4. The algorithm for converting 0.Y(P) to 0.Y(10) is reduced to calculate the value of formula (1). Example: 0.011 2 = 0*2 -1 + 1*2 -2 + 1*2 -3 = 0.25+0.125 = 0.375 10.

There are many ways to represent numbers. In any case, a number is represented by a symbol or a group of symbols (a word) of some alphabet. Such symbols are called numbers.

Number systems

Non-positional and positional number systems are used to represent numbers.

Non-positional number systems

As soon as people started counting, they began to need to write down numbers. Finds by archaeologists at the sites of primitive people indicate that initially the number of objects was displayed by an equal number of some kind of icons (tags): notches, dashes, dots. Later, to make counting easier, these icons began to be grouped in groups of three or five. This system of writing numbers is called unit (unary), since any number in it is formed by repeating one sign, symbolizing one. Echoes of the unit number system are still found today. So, to find out what course a military school cadet is studying in, you need to count how many stripes are sewn on his sleeve. Without realizing it, kids use the unit number system, showing their age on their fingers, and counting sticks are used to teach 1st grade students how to count. Let's look at different number systems.

The unit system is not the most convenient way to write numbers. Recording large quantities in this way is tedious, and the records themselves are very long. Over time, other, more convenient number systems arose.

Ancient Egyptian decimal non-positional number system. Around the third millennium BC, the ancient Egyptians came up with their own numerical system, in which the key numbers were 1, 10, 100, etc. special icons were used - hieroglyphs. All other numbers were composed from these key numbers using the operation of addition. The number system of Ancient Egypt is decimal, but non-positional. In non-positional number systems, the quantitative equivalent of each digit does not depend on its position (place, position) in the number record. For example, to depict 3252, three lotus flowers (three thousand), two rolled palm leaves (two hundreds), five arcs (five tens) and two poles (two units) were drawn. The size of the number did not depend on the order in which its constituent signs were located: they could be written from top to bottom, from right to left, or interspersed.

Roman number system. An example of a non-positional system that has survived to this day is the number system that was used more than two and a half thousand years ago in Ancient Rome. The Roman number system was based on the signs I (one finger) for the number 1, V (open palm) for the number 5, X (two folded palms) for 10, and the first letters of the corresponding Latin words began to be used to designate the numbers 100, 500 and 1000 (Centum – one hundred, Demimille – half a thousand, Mille – one thousand). To write down a number, the Romans decomposed it into the sum of thousands, half thousand, hundreds, fifty, tens, heels, units. For example, the decimal number 28 is represented as follows:

XXVIII=10+10+5+1+1+1 (two tens, fives, three ones).

To record intermediate numbers, the Romans used not only addition, but also subtraction. In this case, the following rule was applied: each smaller sign placed to the right of the larger one is added to its value, and each smaller sign placed to the left of the larger one is subtracted from it. For example, IX stands for 9, XI stands for 11.

The decimal number 99 has the following representation:

XCIХ = –10+100–1+10.

Roman numerals have been used for a very long time. Even 200 years ago, in business papers, numbers had to be denoted by Roman numerals (it was believed that ordinary Arabic numerals were easy to counterfeit). The Roman numeral system is used today mainly for naming significant dates, volumes, sections and chapters in books.

Alphabetic number systems. Alphabetic systems were more advanced non-positional number systems. Such number systems included Greek, Slavic, Phoenician and others. In them, numbers from 1 to 9, whole numbers of tens (from 10 to 90) and whole numbers of hundreds (from 100 to 900) were designated by letters of the alphabet. In the alphabetic number system of Ancient Greece, the numbers 1, 2, ..., 9 were designated by the first nine letters of the Greek alphabet, etc. The following 9 letters were used to denote the numbers 10, 20, ..., 90, and the last 9 letters were used to denote the numbers 100, 200, ..., 900.

Among the Slavic peoples, the numerical values ​​of the letters were established in the order of the Slavic alphabet, which used first the Glagolitic alphabet and then the Cyrillic alphabet.

In Russia, Slavic numbering was preserved until the end of the 17th century. Under Peter I, the so-called Arabic numbering prevailed, which we still use today. Slavic numbering was preserved only in liturgical books.

Non-positional number systems have a number of significant disadvantages:

  • There is a constant need to introduce new symbols for recording large numbers.
  • It is impossible to represent fractional and negative numbers.
  • It is difficult to perform arithmetic operations because there are no algorithms for performing them.

Positional number systems

In positional number systems, the quantitative equivalent of each digit depends on its position (position) in the code (record) of the number. Nowadays we are accustomed to using the decimal positional system - numbers are written using 10 digits. The rightmost digit denotes units, the one to the left - tens, even further to the left - hundreds, etc.

For example: 1) sexagesimal (Ancient Babylon) – the first positional number system. Until now, when measuring time, a base of 60 is used (1min = 60s, 1h = 60min); 2) duodecimal number system (the number 12—“dozen”—was widely used in the 19th century: there are two dozen hours in a day). Counting not by fingers, but by knuckles. Each finger, except the thumb, has 3 joints - 12 in total; 3) currently the most common positional number systems are decimal, binary, octal and hexadecimal (widely used in low-level programming and in general in 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 ).

In any positional system, a number can be represented as a polynomial.

Let's show how to represent a decimal number as a polynomial:

Types of number systems

The most important thing you need to know about the number system is its type: additive or multiplicative. In the first type, each digit has its own meaning, and to read the number you need to add up all the values ​​of the digits used:

XXXV = 10+10+10+5 = 35; CCXIX = 100+100+10–1+10 = 219;

In the second type, each digit can have different meanings depending on its location in the number:

(hieroglyphs in order: 2, 1000, 4, 100, 2, 10, 5)

Here the hieroglyph “2” is used twice, and in each case it took on different meanings “2000” and “20”.

2´ 1000 + 4´ 100+2´ 10+5 = 2425

For an additive (“additional”) system, you need to know all the numbers and symbols with their meanings (there are up to 4-5 dozen of them), and the order of recording. For example, in Latin notation, if a smaller digit is written before a larger one, then subtraction is performed, and if after, then addition (IV = (5–1) = 4; VI = (5+1) = 6).

For a multiplicative system, you need to know the image of the numbers and their meaning, as well as the base of the number system. Determining the base is very easy; you just need to recalculate the number of significant digits in the system. To put it simply, this is the number from which the second digit of the number begins. For example, we use the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. There are exactly 10 of them, so the base of our number system is also 10, and the number system is called “decimal”. The above example uses the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (auxiliary 10, 100, 1000, 10000, etc. do not count). There are also 10 main numbers here, and the number system is decimal.

As you can guess, as many numbers as there are, there can be as many number system bases. But only the most convenient bases of number systems are used. Why do you think the base of the most commonly used human number system is 10? Yes, precisely because we have 10 fingers on our hands. “But there are only five fingers on one hand,” some will say, and they will be right. The history of mankind knows examples of five-fold number systems. “And with legs there are twenty toes,” others will say, and they will also be absolutely right. This is exactly what the Mayans believed. This can even be seen in their numbers.

The concept of “dozen” is very interesting. Everyone knows that this is 12, but few people know where this number came from. Look at your hands, or rather, one hand. How many phalanges are there on all the fingers of one hand, not counting the thumb? That's right, twelve. And the thumb is intended to mark the counted phalanges.

And if on the other hand we put down the number of full dozens with our fingers, we will get the well-known sexagesimal Babylonian system.

Different civilizations counted differently, but even now you can even find in the language, in the names and images of numbers, the remains of completely different number systems that were once used by these people.

So the French once had a base-20 number system, since 80 in French sounds like “four times twenty.”

The Romans, or their predecessors, once used the fivefold system, since V is nothing more than the image of a palm with the thumb extended, and X is two of the same hands.

There are positional and non-positional number systems.

In non-positional number systems the weight of a digit (i.e., the contribution it makes to the value of the number) does not depend on her position in writing the number. Thus, in the Roman number system in the number XXXII (thirty-two), the weight of the number X in any position is simply ten.

In positional number systems the weight of each digit varies depending on its position (position) in the sequence of digits representing the number. For example, in the number 757.7, the first seven means 7 hundreds, the second - 7 units, and the third - 7 tenths of a unit.

The very notation of the number 757.7 means an abbreviated notation of the expression

700 + 50 + 7 + 0,7 = 7 . 10 2 + 5 . 10 1 + 7 . 10 0 + 7 . 10 -1 = 757,7.

Any positional number system is characterized by its basis.

Any natural number can be taken as the base of the system - two, three, four, etc. Hence, innumerable positional systems possible: binary, ternary, quaternary, etc. Writing numbers in each number system with a base q means a shorthand expression

a n-1 q n-1 + a n-2 q n-2 + ... +a 1 q 1 + a 0 q 0 + a -1 q -1 + ... + a -m q -m ,

Where a i - numbers of the number system; n And m - the number of integer and fractional digits, respectively. For example:

What number systems do specialists use to communicate with a computer?

In addition to decimal, systems with a base that is an integer power of 2 are widely used, namely:

    binary(digits 0, 1 are used);

    octal(digits 0, 1, ..., 7 are used);

    hexadecimal(for the first integers from zero to nine, the digits 0, 1, ..., 9 are used, and for the next numbers - from ten to fifteen - the symbols A, B, C, D, E, F are used as digits).

It is useful to remember the notation in these number systems for the first two tens of integers:

Of all number systems especially simple and therefore The binary number system is interesting for technical implementation in computers.

At the early stages of the development of society, people almost did not know how to count. They distinguished between aggregates of two and three objects; any collection containing a larger number of objects was united in the concept “many”. When counting, objects were usually compared with fingers and toes. As civilization developed, the human need to count became necessary. Initially, natural numbers were depicted using a certain number of dashes or sticks, then letters or special signs began to be used to depict them. In ancient Novgorod, the Slavic system was used, where letters of the Slavic alphabet were used; When depicting numbers, the sign ~ (title) was placed above them.

The ancient Romans used numbering, which remains to this day under the name “Roman numbering,” in which numbers are represented by letters of the Latin alphabet. Nowadays it is used to indicate anniversaries, numbering some pages of a book (for example, pages of the preface), chapters in books, stanzas in poems, etc. In their later form, Roman numerals look like this:

I = 1; V = 5; X = 10; L = 50; C = 100; D = 500; M = 1000.

There is no reliable information about the origin of Roman numerals. The number V could originally serve as an image of a hand, and the number X could be made up of two fives. In Roman numbering, traces of the fivefold number system are clearly visible. All whole numbers (up to 5000) are written by repeating the above numbers. Moreover, if a larger number comes before a smaller one, then they are added, but if a smaller one comes before a larger one (in this case it cannot be repeated), then the smaller one is subtracted from the larger one). For example, VI = 6, i.e. 5 + 1, IV = 4, i.e. 5 – 1, XL = 40, i.e. 50 – 10, LX = 60, i.e. 50 + 10. The same number is placed no more than three times in a row: LXX = 70; LXXX = 80; the number 90 is written XC (not LXXXX).

The first 12 numbers are written in Roman numerals like this:

I, II, III, IV, V, VI, VII, VIII. IX, X, XI, XII.

Other numbers are written, for example, as:

XXVIII = 28; ХХХIX = 39; CCCXCVII = 397; MDCCCXVIII = 1818.

Performing arithmetic operations on multi-digit numbers in this notation is very difficult. However, Roman numbering prevailed in Italy until the 13th century, and in other Western European countries until the 16th century.

In the Slavic numbering system, all letters of the alphabet were used to record numbers, although with some violation of the alphabetical order. Different letters meant different numbers of units, tens and hundreds. For example, the number 231 was written as ~ SLA (C – 200, L – 30, A – 1).

These systems are characterized by two disadvantages that led to their displacement by others: the need for a large number of different signs, especially for representing large numbers, and, more importantly, the inconvenience of performing arithmetic operations.

The more convenient and generally accepted and most widespread is the decimal number system, which was invented in India, borrowed there by the Arabs and then after some time came to Europe. In the decimal number system, the base is the number 10.

There were calculus systems with other bases. In Ancient Babylon, for example, the sexagesimal number system was used. We find its remnants in the division of an hour or degree into 60 minutes, and minutes into 60 seconds, which has been preserved to this day.

The duodecimal system was also widespread in ancient times, the origin of which is probably connected, like the decimal system, with counting on fingers: the phalanges (individual joints) of the four fingers of one hand, which were fingered with the thumb of the same hand, were taken as the counting unit. Remnants of this number system have survived to this day, both in oral speech and in customs. It is well known, for example, the name of the unit of the second category - the number 12 - “dozen”. The custom of counting many items not in dozens, but in dozens has been preserved, for example, cutlery in a service or chairs in a furniture set. The name of the third-digit unit in the duodecimal system - gross - is now rare, but in trade practice at the beginning of the century it still existed. For example, in a poem written in 1928 Plyushkin V.V. Mayakovsky, ridiculing people who buy everything in a row, wrote: “...I bought twelve grosses of batons.” A number of African tribes and in Ancient China used a five-fold number system. In Central America (among the ancient Aztecs and Mayans) and among the ancient Celts who inhabited Western Europe, the decimal system was widespread. All of them are also associated with counting on fingers.

The youngest number system can rightfully be considered binary. This system has a number of qualities that make it very advantageous for use in computing machines and modern computers.

Positional and non-positional number systems.

The various number systems that existed in the past and that are used today can be divided into non-positional and positional. The signs used to write numbers are called digits.

In non-positional number systems, the position of the digit in the notation of the number does not depend on the value it represents. An example of a non-positional number system is the Roman system, which uses Latin letters as numbers.

In positional number systems, the value denoted by a digit in a number depends on its position. The number of digits used is called the base of the number system. The place of each digit in a number is called position. The first system known to us based on the positional principle is Babylonian sexagesimal. The numbers in it were of two types, one of which denoted units, the other – tens.

However, the Indo-Arabic decimal system turned out to be the most commonly used. The Indians were the first to use zero to indicate the positional significance of a quantity in a string of numbers. This system is called decimal , because it has ten digits.

The difference between positional and non-positional number systems is most easily understood by comparing two numbers. In the positional number system, comparison of two numbers occurs as follows: in the numbers under consideration, from left to right, digits in the same positions are compared. A larger number corresponds to a larger number value. For example, for the numbers 123 and 234, 1 is less than 2, so 234 is greater than 123. In a non-positional number system, this rule does not apply. An example of this would be a comparison of two numbers IX and VI. Even though I is smaller than V, IX is larger than VI.

Positional number systems.

The base of the number system in which a number is written is usually indicated by a subscript. For example, 555 7 is a number written in the decimal number system. If a number is written in the decimal system, then the base is usually not indicated. The base of the system is also a number, and we will indicate it in the usual decimal system. In general, the number x can be represented in a system with a base p, How x = a n· p n+a n- 1· p n–1 + ap 1 + ap 0, where a n...a 0 – digits in the representation of a given number. For example,

1035 10 =1·10 3 + 0·10 2 + 3·10 1 + 5·10 0 ;

1010 2 = 1 2 3 + 0 2 2 + 1 2 1 + 0 2 0 = 10.

The greatest interest when working on a computer is the number systems with bases 2, 8 and 16. Generally speaking, these number systems are usually enough for the full-fledged work of both a person and a computer, but sometimes, due to various circumstances, you still have to turn to other systems number systems, such as ternary, septal, or base 32.

To operate with numbers written in such non-traditional systems, you need to keep in mind that they are fundamentally no different from the usual decimal system. Addition, subtraction, and multiplication in them are carried out according to the same scheme.

Why aren't other number systems used? Mainly because in everyday life people are accustomed to using the decimal number system, and no other is required. In computers, the binary number system is used, since it is quite simple to operate with numbers written in binary form.

The hexadecimal system is often used in computer science, since writing numbers in it is much shorter than writing numbers in the binary system. The question may arise: why not use a number system, for example base 50, to write very large numbers? Such a number system requires 10 ordinary digits plus 40 signs, which would correspond to the numbers from 10 to 49, and it is unlikely that anyone would like to work with these forty characters. Therefore, in real life, number systems based on bases greater than 16 are practically not used.

Converting numbers from one number system to another.

The most common number systems are binary, hexadecimal and decimal. How are the representations of numbers in different number systems related to each other? There are various ways to convert numbers from one number system to another using specific examples.

Let's say we need to convert the number 567 from decimal to binary. First, the maximum power of two is determined, such that two to this power is less than or equal to the original number. In this case it is 9, because 2 9 = 512, and 2 10 = 1024, which is greater than the starting number. This gives the number of digits in the result; it is equal to 9 + 1 = 10, so the result will look like 1 xxxxxxxxxxxxx, where instead X Can be any binary digits. The second digit of the result is found like this - two is raised to the power of 9 and subtracted from the original number: 567 - 2 9 = 55. The remainder is compared with the number 2 8 = 256. Since 55 is less than 256, the ninth digit is zero, i.e. the result looks like 10 xxxxxxxxxxx. Let's consider the eighth category. Since 2 7 = 128 > 55, then it will also be zero.

The seventh digit also turns out to be zero. The required binary representation of the number takes the form 1000 xxxxxxxx. 2 5 = 32 xxxxx). For the remainder 55 – 32 = 23 the following inequality is true: 2 4 = 16

567 = 1·2 9 + 0·2 8 + 0·2 7 + 0·2 6 + 1·2 5 + 1·2 4 + 0·2 3 + 1·2 2 + 1·2 1 + 1·2 0

Another method of converting numbers uses the column division operation. If you take the same number 567 and divide it by 2, you get the quotient 283 and the remainder is 1. The same operation is performed with the number 283. The quotient is 141, the remainder is 1. Again the resulting quotient is divided by 2 and so on until the quotient will not be less than the divisor. Now, to get a number in the binary number system, it is enough to write down the last quotient, i.e. 1, and add to it in reverse order all the residues obtained during the division process.

The result, of course, has not changed: 567 in the binary number system is written as 1,000,110,111.

These two methods are applicable when converting a number from the decimal system to a system with any base. For example, when converting the number 567 to base 16, the number is first expanded into powers of the base. The required number consists of three digits, because 16 2 = 256 xx, where instead X Can be any hexadecimal digits. It remains to distribute the number 55 among the following digits (567 – 512). 3 16 = 48

The second method consists of sequential division into a column, with the only difference being that you need to divide not by 2, but by 16, and the division process ends when the quotient becomes strictly less than 16.

Of course, to write a number in hexadecimal, you need to replace 10 with A, 11 with B, and so on.

The operation of converting to the decimal system looks much simpler, since any decimal number can be represented as x = ap n + ap n–1 +... + a n-1· p 1 + a n· p 0, where a 0 ... a n– these are the digits of a given number in a number system with a base p.

For example, this is how you can convert the number 4A3F to the decimal system. By definition, 4A3F= 4·16 3 + A·16 2 + 3·16 + F. When replacing A with 10 and F with 15, we get 4·16 3 + 10·16 2 + 3·16 + 15= 19007 .

The easiest way to convert numbers from the binary system to systems with a base equal to powers of two (8 and 16), and vice versa. To write an integer binary number in the base 2 number system n, you need to divide this binary number from right to left into groups according to n- numbers in each; if the last left group contains less than n digits, then add zeros to the required number of digits; consider each group as n-bit binary number, and replace it with the corresponding digit in the base 2 number system n .

Table 1. Binary Hexadecimal Table
Table 1. BINARY-HEX TABLE
2nd 0000 0001 0010 0011 0100 0101 0110 0111
16th 0 1 2 3 4 5 6 7
2nd 1000 1001 1010 1011 1100 1101 1110 1111
16th 8 9 A B C D E F

The famous French astronomer, mathematician and physicist Pierre Simon Laplace (1749–1827) wrote about the historical development of number systems that “The idea of ​​expressing all numbers with nine signs, giving them, in addition to meaning in form, also meaning in place, is so simple that -behind this simplicity it is difficult to understand how amazing it is. How difficult it was to arrive at this method, we see in the example of the greatest geniuses of Greek learning, Archimedes and Apollonius, from whom this idea remained hidden.”

Comparison of the decimal number system with other positional systems allowed mathematicians and design engineers to reveal the amazing capabilities of modern non-decimal number systems, which ensured the development of computer technology.

Anna Chugainova

While studying encodings, I realized that I did not understand number systems well enough. Nevertheless, I often used 2-, 8-, 10-, 16-th systems, converted one to another, but everything was done “automatically”. Having read many publications, I was surprised by the lack of a single, simple-language article on such basic material. That is why I decided to write my own, in which I tried to present the basics of number systems in an accessible and orderly manner.

Introduction

Notation is a way of recording (representing) numbers.

What does this mean? For example, you see several trees in front of you. Your task is to count them. To do this, you can bend your fingers, make notches on a stone (one tree - one finger/notch), or match 10 trees with an object, for example, a stone, and a single specimen with a stick, and place them on the ground as you count. In the first case, the number is represented as a string of bent fingers or notches, in the second - a composition of stones and sticks, where stones are on the left and sticks on the right

Number systems are divided into positional and non-positional, and positional, in turn, into homogeneous and mixed.

Non-positional- the most ancient, in it each digit of a number has a value that does not depend on its position (digit). That is, if you have 5 lines, then the number is also 5, since each line, regardless of its place in the line, corresponds to only 1 item.

Positional system- the meaning of each digit depends on its position (digit) in the number. For example, the 10th number system that is familiar to us is positional. Let's consider the number 453. The number 4 indicates the number of hundreds and corresponds to the number 400, 5 - the number of tens and is similar to the value 50, and 3 - units and the value 3. As you can see, the larger the digit, the higher the value. The final number can be represented as the sum 400+50+3=453.

Homogeneous system- for all digits (positions) of a number the set of valid characters (digits) is the same. As an example, let's take the previously mentioned 10th system. When writing a number in a homogeneous 10th system, you can use only one digit from 0 to 9 in each digit, thus the number 450 is allowed (1st digit - 0, 2nd - 5, 3rd - 4), but 4F5 is not, because the character F is not included in the set of numbers 0 to 9.

Mixed system- in each digit (position) of a number, the set of valid characters (digits) may differ from the sets of other digits. A striking example is the time measurement system. In the category of seconds and minutes there are 60 different symbols possible (from “00” to “59”), in the category of hours – 24 different symbols (from “00” to “23”), in the category of day – 365, etc.

Non-positional systems

As soon as people learned to count, the need arose to write down numbers. In the beginning, everything was simple - a notch or dash on some surface corresponded to one object, for example, one fruit. This is how the first number system appeared - unit.
Unit number system
A number in this number system is a string of dashes (sticks), the number of which is equal to the value of the given number. Thus, a harvest of 100 dates will be equal to a number consisting of 100 dashes.
But this system has obvious inconveniences - the larger the number, the longer the string of sticks. In addition, you can easily make a mistake when writing a number by accidentally adding an extra stick or, conversely, not writing it down.

For convenience, people began to group sticks into 3, 5, and 10 pieces. At the same time, each group corresponded to a specific sign or object. Initially, fingers were used for counting, so the first signs appeared for groups of 5 and 10 pieces (units). All this made it possible to create more convenient systems for recording numbers.

Ancient Egyptian decimal system
In Ancient Egypt, special symbols (numbers) were used to represent the numbers 1, 10, 10 2, 10 3, 10 4, 10 5, 10 6, 10 7. Here are some of them:

Why is it called decimal? As stated above, people began to group symbols. In Egypt, they chose a grouping of 10, leaving the number “1” unchanged. In this case, the number 10 is called the base decimal number system, and each symbol is a representation of the number 10 to some extent.

Numbers in the ancient Egyptian number system were written as a combination of these
characters, each of which was repeated no more than nine times. The final value was equal to the sum of the elements of the number. It is worth noting that this method of obtaining a value is characteristic of every non-positional number system. An example would be the number 345:

Babylonian sexagesimal system
Unlike the Egyptian system, the Babylonian system used only 2 symbols: a “straight” wedge to indicate units and a “recumbent” wedge to indicate tens. To determine the value of a number, you need to divide the image of the number into digits from right to left. A new discharge begins with the appearance of a straight wedge after a recumbent one. Let's take the number 32 as an example:

The number 60 and all its powers are also denoted by a straight wedge, like “1”. Therefore, the Babylonian number system was called sexagesimal.
The Babylonians wrote all numbers from 1 to 59 in a decimal non-positional system, and large values ​​in a positional system with a base of 60. Number 92:

The recording of the number was ambiguous, since there was no digit indicating zero. The representation of the number 92 could mean not only 92=60+32, but also, for example, 3632=3600+32. To determine the absolute value of a number, a special symbol was introduced to indicate the missing sexagesimal digit, which corresponds to the appearance of the number 0 in the decimal number notation:

Now the number 3632 should be written as:

The Babylonian sexagesimal system is the first number system based in part on the positional principle. This number system is still used today, for example, when determining time - an hour consists of 60 minutes, and a minute consists of 60 seconds.

Roman system
The Roman system is not very different from the Egyptian one. It uses capital Latin letters I, V, X, L, C, D and M to represent the numbers 1, 5, 10, 50, 100, 500 and 1000, respectively. A number in the Roman numeral system is a set of consecutive digits.

Methods for determining the value of a number:

  1. The value of a number is equal to the sum of the values ​​of its digits. For example, the number 32 in the Roman numeral system is XXXII=(X+X+X)+(I+I)=30+2=32
  2. If there is a smaller one to the left of the larger digit, then the value is equal to the difference between the larger and smaller digits. At the same time, the left digit can be less than the right one by a maximum of one order of magnitude: for example, only X(10) can appear before L(50) and C(100) among the “lowest” ones, and only before D(500) and M(1000) C(100), before V(5) - only I(1); the number 444 in the number system under consideration will be written as CDXLIV = (D-C)+(L-X)+(V-I) = 400+40+4=444.
  3. The value is equal to the sum of the values ​​of groups and numbers that do not fit into points 1 and 2.
In addition to digital ones, there are also letter (alphabetic) number systems, here are some of them:
1) Slavic
2) Greek (Ionian)

Positional number systems

As mentioned above, the first prerequisites for the emergence of a positional system arose in ancient Babylon. In India, the system took the form of positional decimal numbering using zero, and from the Indians this number system was borrowed by the Arabs, from whom the Europeans adopted it. For some reason, in Europe the name “Arab” was assigned to this system.
Decimal number system
This is one of the most common number systems. This is what we use when we name the price of a product and say the bus number. Each digit (position) can only use one digit from the range from 0 to 9. The base of the system is the number 10.

For example, let’s take the number 503. If this number were written in a non-positional system, then its value would be 5+0+3 = 8. But we have a positional system and that means each digit of the number must be multiplied by the base of the system, in this case the number “ 10” raised to a power equal to the digit number. It turns out that the value is 5*10 2 + 0*10 1 + 3*10 0 = 500+0+3 = 503. To avoid confusion when working with several number systems simultaneously, the base is indicated as a subscript. Thus, 503 = 503 10.

In addition to the decimal system, the 2-, 8-, and 16th systems deserve special attention.

Binary number system
This system is mainly used in computing. Why didn't they use the usual 10th? The first computer was created by Blaise Pascal, who used the decimal system, which turned out to be inconvenient in modern electronic machines, since it required the production of devices capable of operating in 10 states, which increased their price and the final size of the machine. Elements operating in the 2nd system do not have these shortcomings. However, the system in question was created long before the invention of computers and has its “roots” in the Incan civilization, where quipus were used - complex rope weaves and knots.

The binary positional number system has a base of 2 and uses 2 symbols (digits) to write numbers: 0 and 1. Only one digit is allowed in each digit - either 0 or 1.

An example is the number 101. It is similar to the number 5 in the decimal number system. In order to convert from 2 to 10, you need to multiply each digit of a binary number by the base “2” raised to a power equal to the place value. Thus, the number 101 2 = 1*2 2 + 0*2 1 + 1*2 0 = 4+0+1 = 5 10.

Well, for machines the 2nd number system is more convenient, but we often see and use numbers in the 10th system on the computer. How then does the machine determine what number the user is entering? How does it translate a number from one system to another, since it only has 2 symbols - 0 and 1?

In order for a computer to work with binary numbers (codes), they must be stored somewhere. To store each individual digit, a trigger, which is an electronic circuit, is used. It can be in 2 states, one of which corresponds to zero, the other to one. To remember a single number, a register is used - a group of triggers, the number of which corresponds to the number of digits in a binary number. And the set of registers is RAM. The number contained in the register is a machine word. Arithmetic and logical operations with words are performed by an arithmetic logic unit (ALU). To simplify access to registers, they are numbered. The number is called the register address. For example, if you need to add 2 numbers, it is enough to indicate the numbers of the cells (registers) in which they are located, and not the numbers themselves. Addresses are written in octal and hexadecimal systems (they will be discussed below), since the transition from them to the binary system and back is quite simple. To transfer from the 2nd to the 8th, the number must be divided into groups of 3 digits from right to left, and to move to the 16th - 4. If there are not enough digits in the leftmost group of digits, then they are filled from the left with zeros, which are called leading. Let's take the number 101100 2 as an example. In octal it is 101 100 = 54 8, and in hexadecimal it is 0010 1100 = 2C 16. Great, but why do we see decimal numbers and letters on the screen? When you press a key, a certain sequence of electrical impulses is transmitted to the computer, and each symbol has its own sequence of electrical impulses (zeros and ones). The keyboard and screen driver program accesses the character code table (for example, Unicode, which allows you to encode 65536 characters), determines which character the resulting code corresponds to, and displays it on the screen. Thus, texts and numbers are stored in the computer's memory in binary code, and are converted programmatically into images on the screen.

Octal number system
The 8th number system, like the binary one, is often used in digital technology. It has a base of 8 and uses the digits 0 to 7 to write numbers.

An example of an octal number: 254. To convert to the 10th system, each digit of the original number must be multiplied by 8 n, where n is the digit number. It turns out that 254 8 = 2*8 2 + 5*8 1 + 4*8 0 = 128+40+4 = 172 10.

Hexadecimal number system
The hexadecimal system is widely used in modern computers, for example, it is used to indicate color: #FFFFFF - white. The system in question has a base of 16 and uses the following numbers to write: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B. C, D, E, F, where the letters are 10, 11, 12, 13, 14, 15 respectively.

Let's take the number 4F5 16 as an example. To convert to the octal system, we first convert the hexadecimal number into binary, and then, dividing it into groups of 3 digits, into octal. To convert a number to 2, you need to represent each digit as a 4-bit binary number. 4F5 16 = (100 1111 101) 2 . But in groups 1 and 3 there is not enough digit, so let’s fill each with leading zeros: 0100 1111 0101. Now you need to divide the resulting number into groups of 3 digits from right to left: 0100 1111 0101 = 010 011 110 101. Let’s convert each binary group to the octal system, multiplying each digit by 2 n, where n is the digit number: (0*2 2 +1*2 1 +0*2 0) (0*2 2 +1*2 1 +1*2 0) (1*2 2 +1*2 1 +0*2 0) (1*2 2 +0*2 1 +1*2 0) = 2365 8 .

In addition to the considered positional number systems, there are others, for example:
1) Trinity
2) Quaternary
3) Duodecimal

Positional systems are divided into homogeneous and mixed.

Homogeneous positional number systems
The definition given at the beginning of the article describes homogeneous systems quite fully, so clarification is unnecessary.
Mixed number systems
To the already given definition we can add the theorem: “if P=Q n (P,Q,n are positive integers, while P and Q are bases), then the recording of any number in the mixed (P-Q) number system identically coincides with writing the same number in the number system with the base Q.”

Based on the theorem, we can formulate rules for transferring from the P-th to the Q-th systems and vice versa:

  1. To convert from the Q-th to the P-th, you need to divide the number in the Q-th system into groups of n digits, starting with the right digit, and replace each group with one digit in the P-th system.
  2. To convert from P-th to Q-th, it is necessary to convert each digit of a number in the P-th system to Q-th and fill the missing digits with leading zeros, with the exception of the left one, so that each number in the system with base Q consists of n digits .
A striking example is the conversion from binary to octal. Let's take the binary number 10011110 2, to convert it into octal - we will divide it from right to left into groups of 3 digits: 010 011 110, now multiply each digit by 2 n, where n is the digit number, 010 011 110 = (0*2 2 +1 *2 1 +0*2 0) (0*2 2 +1*2 1 +1*2 0) (1*2 2 +1*2 1 +0*2 0) = 236 8 . It turns out that 10011110 2 = 236 8. To make the image of a binary-octal number unambiguous, it is divided into triplets: 236 8 = (10 011 110) 2-8.

Mixed number systems are also, for example:
1) Factorial
2) Fibonacci

Conversion from one number system to another

Sometimes you need to convert a number from one number system to another, so let's look at ways to convert between different systems.
Conversion to decimal number system
There is a number a 1 a 2 a 3 in the number system with base b. To convert to the 10th system, it is necessary to multiply each digit of the number by b n, where n is the number of the digit. Thus, (a 1 a 2 a 3) b = (a 1 *b 2 + a 2 *b 1 + a 3 *b 0) 10.

Example: 101 2 = 1*2 2 + 0*2 1 + 1*2 0 = 4+0+1 = 5 10

Conversion from decimal number system to others
Whole part:
  1. We successively divide the integer part of the decimal number by the base of the system into which we are converting until the decimal number equals zero.
  2. The remainders obtained during division are the digits of the desired number. The number in the new system is written starting from the last remainder.
Fraction:
  1. We multiply the fractional part of the decimal number by the base of the system to which we want to convert. Separate the whole part. We continue to multiply the fractional part by the base of the new system until it equals 0.
  2. Numbers in the new system are made up of whole parts of multiplication results in the order corresponding to their production.
Example: convert 15 10 to octal:
15\8 = 1, remainder 7
1\8 = 0, remainder 1

Having written all the remainders from bottom to top, we get the final number 17. Therefore, 15 10 = 17 8.

Converting from binary to octal and hexadecimal
To convert to octal, we divide the binary number into groups of 3 digits from right to left, and fill the missing outermost digits with leading zeros. Next, we transform each group by multiplying the digits sequentially by 2n, where n is the number of the digit.

Let's take the number 1001 2 as an example: 1001 2 = 001 001 = (0*2 2 + 0*2 1 + 1*2 0) (0*2 2 + 0*2 1 + 1*2 0) = (0+ 0+1) (0+0+1) = 11 8

To convert to hexadecimal, we divide the binary number into groups of 4 digits from right to left, then similar to the conversion from 2nd to 8th.

Convert from octal and hexadecimal to binary
Conversion from octal to binary - we convert each digit of an octal number into a binary 3-digit number by dividing by 2 (for more information about division, see the paragraph “Converting from the decimal number system to others” above), fill the missing outermost digits with leading zeros.

For example, consider the number 45 8: 45 = (100) (101) = 100101 2

Translation from the 16th to the 2nd - we convert each digit of a hexadecimal number into a binary 4-digit number by dividing by 2, filling the missing outer digits with leading zeros.

Converting the fractional part of any number system to decimal

The conversion is carried out in the same way as for integer parts, except that the digits of the number are multiplied by the base to the power “-n”, where n starts from 1.

Example: 101,011 2 = (1*2 2 + 0*2 1 + 1*2 0), (0*2 -1 + 1*2 -2 + 1*2 -3) = (5), (0 + 0 .25 + 0.125) = 5.375 10

Converting the fractional part of binary to 8th and 16th
The translation of the fractional part is carried out in the same way as for whole parts of a number, with the only exception that the division into groups of 3 and 4 digits goes to the right of the decimal point, the missing digits are supplemented with zeros to the right.

Example: 1001.01 2 = 001 001, 010 = (0*2 2 + 0*2 1 + 1*2 0) (0*2 2 + 0*2 1 + 1*2 0), (0*2 2 + 1*2 1 + 0*2 0) = (0+0+1) (0+0+1), (0+2+0) = 11.2 8

Converting the fractional part of the decimal system to any other
To convert the fractional part of a number to other number systems, you need to turn the whole part into zero and begin multiplying the resulting number by the base of the system to which you want to convert. If, as a result of multiplication, whole parts appear again, they must be turned to zero again, after first remembering (writing down) the value of the resulting whole part. The operation ends when the fractional part is completely zero.

For example, let's convert 10.625 10 to binary:
0,625*2 = 1,25
0,250*2 = 0,5
0,5*2 = 1,0
Writing down all the remainders from top to bottom, we get 10.625 10 = (1010), (101) = 1010.101 2