Find Roman numerals. Translation of Roman, Indian, Arabic numerals (numbers)

We all use Roman numerals - we use them to mark the numbers of centuries or months of the year. Roman numerals are found on clock dials, including the chimes of the Spasskaya Tower. We use them, but we don't know much about them.

How do Roman numerals work?

The Roman counting system in its modern version consists of the following basic signs:

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

To remember numbers that are unusual for us who use the Arabic system, there are several special mnemonic phrases in Russian and English:
We Give Juicy Lemons, That's Enough
We Give Advice Only to Well-Educated Individuals
I Value Xylophones Like Cows Dig Milk

The system for arranging these numbers relative to each other is as follows: numbers up to three inclusive are formed by adding units (II, III) - repeating any number four times is prohibited. To form numbers greater than three, the larger and smaller digits are added or subtracted, for subtraction the smaller digit is placed before the larger one, for addition - after, (4 = IV), the same logic applies to other digits (90 = XC). The order of thousands, hundreds, tens and units is the same as what we are used to.

It is important that any number should not be repeated more than three times, so the longest number up to a thousand is 888 = DCCCLXXXVIII (500+100+100+100+50+10+10+10+5+1+1+1).

Alternative options

The ban on the fourth use of the same number in a row began to appear only in the 19th century. Therefore, in ancient texts one can see variants IIII and VIII instead of IV and IX, and even IIII or XXXXXX instead of V and LX. Remnants of this writing can be seen on the clock, where four is often marked with four units. In old books, there are also frequent cases of double subtractions - XIIX or IIXX instead of the standard XVIII.

Also in the Middle Ages, a new Roman numeral appeared - zero, which was denoted by the letter N (from the Latin nulla, zero). Large numbers were marked with special signs: 1000 - ↀ (or C|Ɔ), 5000 - ↁ (or |Ɔ), 10000 - ↂ (or CC|ƆƆ). Millions are obtained by double underlining standard numbers. Fractions were also written in Roman numerals: ounces were marked using symbols - 1/12, half was marked with the symbol S, and everything greater than 6/12 was marked with an addition: S = 10\12. Another option is S::.

Origin

At the moment there is no single theory of the origin of Roman numerals. One of the most popular hypotheses is that Etruscan-Roman numerals originated from a counting system that uses notched strokes instead of numbers.

Thus, the number “I” is not the Latin or more ancient letter “i”, but a notch reminiscent of the shape of this letter. Every fifth notch was marked with a bevel - V, and the tenth was crossed out - X. The number 10 in this count looked like this: IIIIΛIIIIX.

It is thanks to this recording of numbers in a row that we owe a special system of adding Roman numerals: over time, the recording of the number 8 (IIIIΛIII) could be reduced to ΛIII, which convincingly demonstrates how the Roman counting system acquired its specificity. Gradually, the notches turned into graphic symbols I, V and X, and acquired independence. Later they began to be identified with Roman letters - since they were similar in appearance to them.

An alternative theory belongs to Alfred Cooper, who suggested looking at the Roman counting system from a physiological point of view. Cooper believes that I, II, III, IIII is a graphical representation of the number of fingers of the right hand that the trader throws out when calling the price. V is the extended thumb, which together with the palm forms a figure similar to the letter V.

That is why Roman numerals add up not only ones, but also add them with fives - VI, VII, etc. - this is the thumb thrown back and the other fingers of the hand extended. The number 10 was expressed by crossing the hands or fingers, hence the symbol X. Another option was to simply double the number V, getting an X. Large numbers were transmitted using the left palm, which counted tens. So gradually the signs of ancient finger counting became pictograms, which then began to be identified with the letters of the Latin alphabet.

Modern Application

Today in Russia, Roman numerals are needed, first of all, to record the number of the century or millennium. It is convenient to place Roman numerals next to Arabic ones - if you write the century in Roman numerals, and then the year in Arabic, then your eyes will not be dazzled by the abundance of identical signs. Roman numerals have a certain connotation of archaism. They are also traditionally used to indicate the serial number of the monarch (Peter I), the volume number of a multi-volume publication, and sometimes the chapter of a book. Roman numerals are also used in antique watch dials. Important numbers, such as the year of the Olympiad or the number of a scientific law, can also be recorded using Roman numerals: World War II, Euclid's V postulate.

In different countries, Roman numerals are used slightly differently: in the USSR it was customary to indicate the month of the year using them (1.XI.65). In the West, the year number is often written in Roman numerals in the credits of films or on the facades of buildings.

In parts of Europe, especially in Lithuania, you can often find the days of the week designated in Roman numerals (I – Monday, and so on). In Holland, Roman numerals are sometimes used to denote floors. And in Italy they mark 100-meter sections of the route, marking, at the same time, every kilometer with Arabic numerals.

In Russia, when writing by hand, it is customary to emphasize the Roman numerals below and above at the same time. However, often in other countries, the underscore meant increasing the case of the number by 1000 times (or 10,000 times with a double underscore).

There is a common misconception that modern Western clothing sizes have some connection with Roman numerals. In fact, the designations are XXL, S, M, L, etc. have no connection with them: these are abbreviations of the English words eXtra (very), Small (small), Large (large).

In the modern world, Arabic numerals are considered the generally accepted standard of calculation. The decimal system is used for counting and numbering in all developed countries of the world. At the same time, Roman numerals, which were used in the non-positional number system of the ancient Romans, were not completely abandoned. You can often see that they are used to number sections in books, mark centuries in historical literature, indicate blood type and many other parameters for which the designation in Roman numerals has become standard.

When working on a computer with a browser, text editors, and other applications, you may need to enter some values ​​in Roman numerals. There is no separate numeric block with them on a standard input device, but there are several ways to quickly write Roman numerals on the keyboard.

Roman numerals on the keyboard in any application

Only a small number of application developers provide convenient ways to enter Roman numerals using the keyboard in their products. Most programs do not have special functionality for working with a non-positional number system, which requires the user to be smart enough to enter Roman numerals into them. There are two convenient ways to enter Roman numerals from the keyboard in any program.

Replacing Roman numerals with English letters

On any computer, by default one of the available languages ​​is English. You can quickly switch to it using the key combination Alt+Shift or Windows+Space (in Windows 10). The English alphabet completely eliminates the need for a separate numeric keypad for entering Roman numerals, since all their analogues can be typed using it in capital letters.

The following letters of the English alphabet replace Roman numerals:

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

Even at school, they teach how to use Roman numerals to enter various numbers. The principle is simple: the largest Roman numerals suitable for the given situation are used to get to the required number.

For example:

To enter the number 33, you will need to use 10+10+10+1+1+1.

Accordingly, in the Roman variation the number 33 would be written as follows: XXXIII.

There are also some special rules for entering Roman numerals that allow you to shorten the writing of large numbers.

Using ASCII codes to enter Roman numerals

The Windows operating system supports ASCII codes for entering various characters. They can be used, among other things, to enter Roman numerals.

ASCII is an American encoding table that lists the most popular printable and non-printable characters in numerical combinations. To use the characters from this table on a standard keyboard to enter Roman numerals, you must use the NUM number block - located on the right side of the keyboard.

Activate the additional numeric keypad using the Num Lock button. After that, hold down the left ALT on the keyboard and enter combinations of Roman numerals on the right number pad. After entering each character, you need to release ALT so that the character appears in the input field. Then again you need to hold down ALT and you can enter the next character.

The following combinations of the additional number block are identical to Roman numerals:

  • ALT+73 – I;
  • ALT+86 – V;
  • ALT+88 – X;
  • ALT+76 – L;
  • ALT+67 – C;
  • ALT+68 – D;
  • ALT+77 – M.

The method of entering Roman numerals using ASCII codes cannot be called convenient, but it can be used, for example, when for one reason or another the English keyboard layout is disabled.

How to Type Roman Numerals in Word

Microsoft, when developing the office suite and Word application, took into account that users who work with texts may need to enter Roman numerals. Since doing this using the English layout or ASCII codes is not particularly convenient, Microsoft introduced support for a special command in Word that automatically converts Arabic numerals to Roman numerals.

Roman numerals often cause us confusion.
But it is they who are usually used when numbering centuries and book chapters, when designating clothing sizes and steps in music.
Roman numerals are present in our lives. So it's too early to abandon them. Easier to learn, understand and learn. Moreover, it is not difficult.
So, to denote numbers in the Latin language, combinations of the following 7 characters are accepted: I (1), V (5), X (10), L (50), C (100), D (500), M (1000).
Why were Latin letters chosen to represent the numbers 5, 50, 100, 500 and 1000? It turns out that these are not Latin letters, but completely different characters. The fact is that the basis for the Latin alphabet (and it, by the way, exists in several versions - 23, 24 and 25 letters) was the Western Greek alphabet.

Thus, three signs L, C, and M go back to the Western Greek alphabet. Here they denoted aspirated sounds, which were not in the Latin language. When the Latin alphabet was drawn up, they turned out to be superfluous. And they were adapted to represent numbers in the Latin alphabet. Later they coincided in spelling with Latin letters. Thus, the sign C (100) became similar to the first letter of the Latin word centum (one hundred), and M - (1000) - the first letter of the word mille (thousand). As for the sign D (500), it was half of the sign F (1000), and then it became similar to a Latin letter. The V sign (5) was just the upper half of the X sign (10).
In this regard, by the way, the popular theory that the name of the church office of the Pope (Vicarius Filii Dei) when replacing the letters with Roman numerals in total gives the “devil's number” seems funny.

So, how do you understand Latin numbers?
If the sign denoting a smaller number is to the right of the sign denoting a larger number, then the smaller is added to the larger; if on the left, then subtract:
VI - 6, i.e. 5+1
IV - 4, i.e. 5-1
LX - 60, i.e. 50+10
XL - 40, i.e. 50-10
CX - 110, i.e. 100+10
XC - 90, i.e. 100-10
MDCCCXII - 1812, i.e. 1000+500+100+100+100+10+1+1.

Different designations for the same number are possible. Thus, the number 80 can be represented as LXXX (50+10+10+10) and as XXC(100-20).
Basic Roman numerals look like this:
I(1) - unus (unus)
II(2) - duo (duo)
III(3) - tres (tres)
IV(4) - quattuor (quattuor)
V(5) - quinque
VI(6) - sex (sex)
VII (7) - septem (septem)
VIII (8) - octo (octo)
IX (9) - novem (novem)
X (10) - decem (decem), etc.

XX (20) - viginti (viginti)
XXI (21) - unus et viginti or viginti unus
XXII (22) - duo et viginti or viginti duo, etc.
XXVIII (28) - duodetriginta (duodetriginta)
XXIX (29) - undetriginta (undetriginta)
XXX (30) - triginta (triginta)
XL (40) - quadraginta (quadraginta)
L (50) - quinquaginta (quinquaginta)
LX (60) - sexaginta (sexaginta)
LXX (70) - septuaginta (septuaginta)
LXXX (80) - octoginta (octogintna)
XC (90) - nonaginta (nonaginta)
C (100) - centum (centum)
CC (200) - ducenti (ducenti)
CCC (300) - trecenti (trecenti)
CD (400) - quadrigenti (quadrigenti)
D (500) - quingenti (quingenti)
DC (600) - sexcenti (sexcenti)
DCC (700) - septigenti (septigenti)
DCCC(800) - octingenti (octigenti)
CM (DCCCC) (900) - nongenti (nongenti)
M (1000) - mille (mille)
MM (2000) - duo milia (duo milia)
V (5000) - quinque milia (quinque milia)
X (10000) - decem milia (decem milia)
XX (20000) - viginti milia (viginti milia)
C (1,000,000) - centum milia (centum milia)
XI (1000000) - decies centena milia (decies centena milia)"

Elena Dolotova.

Today in Russia, Roman numerals are needed, first of all, to record the number of the century or millennium. It is convenient to place Roman numerals next to Arabic ones - if you write the century in Roman numerals, and then the year in Arabic, then your eyes will not be dazzled by the abundance of identical signs. Roman numerals have a certain connotation of archaism. They are also traditionally used to indicate the serial number of the monarch (Peter I), the volume number of a multi-volume publication, and sometimes the chapter of a book. Roman numerals are also used in antique watch dials. Important numbers, such as the year of the Olympiad or the number of a scientific law, can also be recorded using Roman numerals: World War II, Euclid's V postulate.

In different countries, Roman numerals are used slightly differently: in the USSR it was customary to indicate the month of the year using them (1.XI.65). In the West, the year number is often written in Roman numerals in the credits of films or on the facades of buildings.

In parts of Europe, especially in Lithuania, you can often find the days of the week designated in Roman numerals (I – Monday, and so on). In Holland, Roman numerals are sometimes used to denote floors. And in Italy they mark 100-meter sections of the route, marking, at the same time, every kilometer with Arabic numerals.

In Russia, when writing by hand, it is customary to emphasize the Roman numerals below and above at the same time. However, often in other countries, the underscore meant increasing the case of the number by 1000 times (or 10,000 times with a double underscore).

There is a common misconception that modern Western clothing sizes have some connection with Roman numerals. In fact, the designations are XXL, S, M, L, etc. have no connection with them: these are abbreviations of the English words eXtra (very), Small (small), Large (large).

Roman notation uses seven numerals - I, V, X, L, L, D, M. To represent the number n in Roman notation, we take the numbers of its units n 0, tens n 1, hundreds n 2 and thousands n 3. First, let's write down the number of units in Roman notation. For 0 ⩽ n 0 ⩽ 3, we simply write down the number I (one) n 0 times in a row. For 4 ⩽ n 0 ⩽ 8, we write down the number V (it means five), and add to it as many digits I as n 0 is more or less than five, and if more, then on the right, and if less, then on the left. Finally, we write n 0 = 9 as IX (X denotes ten, I on the left shows that the ten is missing one).

We will do the same with the number of tens n 1, only instead of the numbers I =1, V =5, C =10 we will use X =10, L =50, C =100.

The same rules apply to the number of hundreds n 2, the numbers C = 100, D = 500, M = 1000 are used for recording.

For thousands of Roman numerals it will only suffice for 0 ⩽ n 3 ⩽ 3, so you get either M, MM, or MMM.

All listed rules are summarized in the table.


Now let's put together the entries for n 3, n 2, n 1, n 0 in the order listed. The Roman number is ready.

For example, the number 1987 is written as MCMLXXXVII. Here 1000 = M, 900 = CM, 80 = LXXX and 7 = VII.

The disadvantage of Roman notation is visible: using six digits, it allows you to represent numbers no more than 3999.

An analysis of the rules for converting numbers into Roman notation shows that it is enough to write each of the decimal digits of a given number in Roman numerals, taking into account the number of its digit, and then put the resulting entries together. The rules for writing a decimal digit using Roman numerals are approximately the same - only the set of Roman numerals used for writing changes depending on the digit. For units it is I, V, X, for tens - X, L, C, for hundreds - C, D, M, for thousands - only M (since there are no digits for five and ten thousand).

Given this circumstance, it would be reasonable to implement in the form of a procedure (let's call it toRomanHelper) the conversion of a decimal digit to Roman notation. The procedure will take two parameters - a decimal digit and a decimal place number. The return value is the Roman notation of the decimal digit corresponding to its digit.

The toRoman procedure will handle the conversion of the number to Roman notation. She will parse the number into decimal digits. For each decimal digit, it will find a notation in Roman numerals in accordance with the digit in which it is located (toRomanHelper procedure will be called for this). The Roman notations for the decimal digits will be concatenated together and the resulting string will be returned from the procedure.

The reverse conversion will be done in reverse order. The string representing the Roman number must first be divided into decimal places, and then we find the decimal digits corresponding to these places.

The task of categorization will now be more difficult. The point is that not every string composed of Roman numerals will be a valid Roman notation for a number (unlike decimal notation, in which any sequence of decimal digits will be valid).

In accordance with the rules for forming the Roman notation of numbers, the correct notation is four groups of Roman numerals composed together. The first (located on the left) is the group denoting thousands, then there is the group of hundreds, then tens, and finally units. What each of these groups may consist of can be seen in the corresponding column of Table 31.1. "Writing decimal places in Roman numerals".

A good solution would be to use regular expressions to divide the Roman notation into groups of digits by digit. For each group, you need to create a template and enclose it in captivating brackets. The patterns for thousands, hundreds, tens, and ones, put together, will produce a regular expression that the entire Roman notation must match. Therefore, you should add anchors to the beginning and end of the string in your regular expression.

Let's start creating a template for the units digit. The solution that first comes to mind is to list all the alternatives: (|I|II|III|IV|V|VI|VII|VIII|IX) . Note the empty alternative with which the enumeration begins: the group of units in Roman notation can be empty. This decision can be made a little easier by using quantifiers. For numbers from 0 to 3 you can write I(0,3) instead of |I|II|III, for numbers from 5 to 8 you can write VI(0,3) instead of V|VI|VII|VIII. Thus, for the ones place we get the pattern (I(0,3)|IV|VI(0,3)|IX) . It can be further simplified by combining the first alternative with the third, and the second with the fourth: (V?I(0,3)|I) .

For tens and hundreds, exactly the same patterns are obtained, only composed of other Roman numerals: (L?X(0,3)|X) (tens) and (D?C(0,3)|C) (hundreds). For the thousands place the pattern is quite simple: (M(0,3)) .

So, for the whole Roman notation we get the following regular expression: ^(M(0,3))(D?C(0,3)|C)(L?X(0,3)|X)(V?I(0 ,3)|I)$ .