Roman number d. How are Roman numerals arranged?

Tax Code of the Russian Federation 17.12.2022
Tax Code of the Russian Federation

Roman numerals- numerals used by the ancient Romans in their non-positional number system.

Natural numbers are written by repeating these digits. At the same time, if a large number is in front of a smaller one, then they are added (the principle of addition), if the smaller one is in front of the larger one, then the smaller one is subtracted from the larger one (the principle of subtraction). The last rule applies only to avoid the fourfold repetition of the same figure.

Roman numerals appeared around 500 BC with the Etruscans.

Numbers

To fix the alphabetic designations of numbers in descending order, there is a mnemonic rule:

M s D arim FROM face-to-face L imony, X vatite V sem I X.

Respectively M, D, C, L, X, V, I

To correctly write large numbers in Roman numerals, you must first write down the number of thousands, then hundreds, then tens, and finally units.

There is a "shortcut" for writing large numbers, such as 1999. It is not recommended, but is sometimes used for simplicity. The difference is that to reduce a digit, any digit can be written to the left of it:

  • 999. Thousand (M), subtract 1 (I), get 999 (IM) instead of CMXCIX. Consequence: 1999 - MIM instead of MCMXCIX
  • 95. One hundred (C), subtract 5 (V), get 95 (VC) instead of XCV
  • 1950: Thousand (M), subtract 50 (L), we get 950 (LM). Consequence: 1950 - MLM instead of MCML

It was only in the 19th century that the number “four” was written universally as “IV”, before that the record “IIII” was most often used. However, the entry "IV" can be found already in the documents of the "Forme of Cury" manuscript dating back to 1390. Watch dials have traditionally used "IIII" instead of "IV" in most cases, mainly for aesthetic reasons: this spelling provides visual symmetry with the numbers "VIII" on the opposite side, and the reversed "IV" is more difficult to read than "IIII".

Application of Roman Numerals

In Russian, Roman numerals are used in the following cases:

  • Century or millennium number: XIX century, II millennium BC. e.
  • The serial number of the monarch: Charles V, Catherine II.
  • Volume number in a multi-volume book (sometimes numbers of book parts, sections or chapters).
  • In some editions - page numbers with the preface to the book, so as not to correct references inside the main text when changing the preface.
  • Antique watch dial markings.
  • Other important events or list items, such as: V postulate of Euclid, World War II, XXII Congress of the CPSU, etc.

In other languages, the scope of Roman numerals may have some peculiarities, for example, in Western countries, Roman numerals sometimes record the year number.

Roman Numerals and Unicode

The Unicode standard defines characters to represent Roman numerals as part of Numeric forms(English) Number Forms), in the area of ​​characters with codes from U+2160 to U+2188. For example, MCMLXXXVIII can be represented in the form ⅯⅭⅯⅬⅩⅩⅩⅧ . This range includes both lowercase and uppercase digits from 1 (Ⅰ or I) to 12 (Ⅻ or XII), including combined glyphs for compound numbers such as 8 (Ⅷ or VIII), mainly for compatibility with East Asian character sets in industry standards such as JIS X 0213 where these characters are defined. Combined glyphs are used to represent numbers that were previously made up of single characters (e.g. Ⅻ instead of its representation as Ⅹ and Ⅱ). In addition, glyphs exist for archaic 1000, 5000, 10000, big reversed C (Ɔ), late 6 (ↅ, similar to the Greek stigma: Ϛ), early 50 (ↆ, similar to to the down arrow ↓⫝⊥ ), 50,000, and 100,000. It should be noted that the small back c, ↄ is not included in Roman numeral characters, but is included in the Unicode standard as the uppercase Claudian letter Ↄ .

Roman Numerals to Unicode
The code 0 1 2 3 4 5 6 7 8 9 A B C D E F
Meaning 1 2 3 4 5 6 7 8 9 10 11 12 50 100 500 1 000
U+2160
2160

2161

2162

2163

2164

2165

2166

2167

2168

2169

216A

216B

216C

216D

216E

216F
U+2170
2170

2171

2172

2173

2174

2175

2176

2177

2178

2179

217A

217B

217C

217D

217E

217F
Meaning 1 000 5 000 10 000 - - 6 50 50 000 100 000
U+2160! U+2180
2180

2181

2182

Characters in the range U+2160-217F are present only for compatibility with other standards that define those characters. In everyday life, ordinary letters of the Latin alphabet are used. The display of such characters requires software that supports the Unicode standard and a font that contains glyphs corresponding to these characters.

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

How are Roman numerals arranged?

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

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

To remember numbers that are unusual for us using the Arabic system, there are several special mnemonic phrases in Russian and English:
We Give Juicy Lemons, Enough for Everyone Ix
We Advise Only Well-Brought-Up Individuals
I Value Xylophones Like Cows Dig Milk

The system of arrangement of these numbers relative to each other is as follows: numbers up to three inclusive are formed by adding units (II, III), - the fourfold repetition of any number is prohibited. To form numbers greater than three, the larger and smaller digits are added or subtracted, to subtract, the smaller digit is placed before the larger one, to add - after, (4 \u003d IV), the same logic works with other numbers (90 \u003d XC). The arrangement of thousands, hundreds, tens and units is the same as we are used to.

It is important that any digit should not repeat 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).

Alternatives

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 VIIII instead of IV and IX, and even IIIII or XXXXXX instead of V and LX. The remains of this writing can be seen on the clock, where four is often marked with exactly four units. In old books, there are also frequent cases of double subtractions - XIIX or IIXX instead of the standard XVIII in our days.

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 characters: 1000 - ↀ (or C|Ɔ), 5000 - ↁ (or |Ɔ), 10000 - ↂ (or CC|ƆƆ). Millions are obtained by double underlining the standard digits. Fractions were also written in Roman numerals: ounces were marked with the help of icons - 1/12, half was marked with the symbol S, and everything that was more than 6/12 was added: S = 10\12. Another option is S::.

Origin

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

Thus, the number "I" is not the Latin or more ancient letter "i", but a notch that resembles 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 account looked like this: IIIIΛIIIIX.

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

An alternative theory belongs to Alfred Cooper, who suggested considering the Roman counting system from the point of view of physiology. Cooper believes that I, II, III, IIII is a graphical representation of the number of fingers of the right hand thrown out by the trader when naming the price. V - this is a set aside thumb, forming together with the palm a figure similar to the letter V.

That is why Roman numerals sum up not only units, but also add them to fives - VI, VII, etc. - this is the thumb and other exposed fingers of the hand. The number 10 was expressed using the crossing of hands or fingers, hence the symbol X. Another option is that the number V was simply doubled, getting X. Large numbers were transmitted using the left palm, which counted tens. So gradually the signs of the ancient finger count 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 put Roman numerals next to Arabic ones - if you write a century in Roman numerals, and then a year in Arabic, then your eyes will not ripple from the abundance of identical signs. Roman numerals are somewhat archaic. With their help, they also traditionally indicate the serial number of the monarch (Peter I), the number of the volume of a multi-volume edition, and sometimes the chapter of the 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 fifth postulate.

In different countries, Roman numerals are used a little differently: in the USSR it was customary to use them to indicate the month of the year (1.XI.65). In the West, Roman numerals often write the number of the year in movie credits or on building facades.

In a part of Europe, especially in Lithuania, one can often find Roman numerals designating the days of the week (I - Monday, and so on). In the Netherlands, Roman numerals sometimes represent floors. And in Italy, they mark 100-meter sections of the path, marking, at the same time, with Arabic numerals each kilometer.

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

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

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

How are Roman numerals arranged?

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

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

To remember numbers that are unusual for us using the Arabic system, there are several special mnemonic phrases in Russian and English:
We Give Juicy Lemons, Enough for Everyone Ix
We Advise Only Well-Brought-Up Individuals
I Value Xylophones Like Cows Dig Milk

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

It is important that any digit should not repeat 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).

Alternatives

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 VIIII instead of IV and IX, and even IIIII or XXXXXX instead of V and LX. The remains of this writing can be seen on the clock, where four is often marked with exactly four units. In old books, there are also frequent cases of double subtractions - XIIX or IIXX instead of the standard XVIII in our days.

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 characters: 1000 - ↀ (or C|Ɔ), 5000 - ↁ (or |Ɔ), 10000 - ↂ (or CC|ƆƆ). Millions are obtained by double underlining the standard digits. Fractions were also written in Roman numerals: ounces were marked with the help of icons - 1/12, half was marked with the symbol S, and everything that was more than 6/12 was added: S = 10\12. Another option is S::.

Origin

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

Thus, the number "I" is not the Latin or more ancient letter "i", but a notch that resembles 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 account looked like this: IIIIΛIIIIX.

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

An alternative theory belongs to Alfred Cooper, who suggested considering the Roman counting system from the point of view of physiology. Cooper believes that I, II, III, IIII is a graphical representation of the number of fingers of the right hand thrown out by the trader when naming the price. V - this is a set aside thumb, forming together with the palm a figure similar to the letter V.

That is why Roman numerals sum up not only units, but also add them to fives - VI, VII, etc. - this is the thumb and other exposed fingers of the hand. The number 10 was expressed using the crossing of hands or fingers, hence the symbol X. Another option is that the number V was simply doubled, getting X. Large numbers were transmitted using the left palm, which counted tens. So gradually the signs of the ancient finger count 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 put Roman numerals next to Arabic ones - if you write a century in Roman numerals, and then a year in Arabic, then your eyes will not ripple from the abundance of identical signs. Roman numerals are somewhat archaic. With their help, they also traditionally indicate the serial number of the monarch (Peter I), the number of the volume of a multi-volume edition, and sometimes the chapter of the 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 fifth postulate.

In different countries, Roman numerals are used a little differently: in the USSR it was customary to use them to indicate the month of the year (1.XI.65). In the West, Roman numerals often write the number of the year in movie credits or on building facades.

In a part of Europe, especially in Lithuania, one can often find Roman numerals designating the days of the week (I - Monday, and so on). In the Netherlands, Roman numerals sometimes represent floors. And in Italy, they mark 100-meter sections of the path, marking, at the same time, with Arabic numerals each kilometer.

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

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

Clock-chimes of the Spasskaya Tower with Roman numerals on the dial Numeral systems in culture Indo-ArabicEast AsianAlphabeticalOther Positional Mixed systems Non-positional
Arabic
Tamil
Burmese
Khmer
Lao
Mongolian
Thai
Chinese
Japanese
Suzhou
Korean
Vietnamese
counting sticks
Abjadia
Armenian
Aryabhata
Cyrillic
Greek
Ethiopian
Jewish
Akshara-sankhya
Babylonian
Egyptian
Etruscan
Roman
Danube
Attic
Kipu
Mayan
Aegean
Symbols of the KPU
2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 60
Nega-positional
symmetrical
Fibonacci
Singular (unary)

Roman numerals- numbers used by the ancient Romans in their non-positional number system.

Natural numbers are written by repeating these digits. At the same time, if a large number is in front of a smaller one, then they are added (the principle of addition), if the smaller one is in front of a larger one, then the smaller one is subtracted from the larger one (the principle of subtraction). The last rule applies only to avoid the fourfold repetition of the same figure.

Roman numerals appeared 500 BC from the Etruscans, who may have borrowed some of the numbers from the proto-Celts.

Roman numerals

Number Designation
1 I
2 II
3 III
4 IV, until the XIX century - III
5 V
6 VI
7 VII
8 VIII (sometimes - IIX)
9 IX (sometimes - VIIII)
10 X
20 XX
30 XXX
40 XL
50 L
60 LX
70 LXX
80 LXXX
90 XC
100 C
200 CC
300 CCC
400 CD
500 D; IƆ
600 DC; IƆC
700 DCC; IƆCC
800 DCCC; IƆCCC
900 CM; CCIƆ
1 000 M; ↀ; CIƆ
2 000 MM; CIƆCIƆ
3 000 MMM; CIƆCIƆCIƆ
3 999 MMMCMXCIX
4 000 MV; ↀↁ; CIƆIƆƆ
5 000 V; ↁ; IƆƆ
6 000 VM; ↁↀ; IƆƆCIƆ
7 000 VMM; ↁↀↀ; IƆƆCIƆCIƆ
8 000 VMMM; ↁↀↀↀ; IƆƆCIƆCIƆCIƆ
9 000 IX; ↀↂ; CIƆCCIƆƆ
10 000 x; ↂ; CCIƆƆ
20 000 XX; ↂↂ; CCIƆƆCCIƆƆ
30 000 XXX; ↂↂↂ; CCIƆƆCCIƆƆCCIƆƆ
40 000 XL; ↂↇ; CCIƆƆƆƆƆ
50 000 L; ↇ; IƆƆƆ
60 000 LX; ↇↂ; IƆƆƆCCIƆƆ
70 000 LXX; ↇↂↂ; IƆƆƆCCIƆƆCCIƆƆ
80 000 LXXX; ↇↂↂↂ; IƆƆƆCCIƆƆCCIƆƆCCIƆƆ
90 000 XC; ↂↈ; CCIƆƆCCCIƆƆƆ
100 000 C; ↈ; CCCIƆƆƆ
200 000 CC; ↈↈ; CCCIƆƆƆCCCIƆƆƆ
300 000 CCC; ↈↈↈ; CCCIƆƆƆCCCIƆƆƆCCCIƆƆƆ
400 000 CD; CCCIƆƆƆIƆƆƆƆ
500 000 D; IƆƆƆƆ
600 000 DC; IƆƆƆƆCCCIƆƆƆ
700 000 DCC; IƆƆƆƆCCCIƆƆƆCCCIƆƆƆ
800 000 DCCC; IƆƆƆƆCCCIƆƆƆCCCIƆƆƆCCCIƆƆƆ
900 000 CM; CI; CCCIƆƆƆCCCCIƆƆƆƆ
1 000 000 M; I; CCCCIƆƆƆƆ

no more than three times in a row no more than 3999 source not specified 2369 days

XXXII- in particular, it is customary to highlight Roman numerals in Russian handwritten text (this is not used in typographic typesetting due to technical complexity). For other authors, the overline could indicate an increase in the value of the figure by 1000 times: V = 5000.

Tissot watches with the traditional spelling "IIII"

It was only in the 19th century that the number “four” was written universally as “IV”, before that the record “IIII” was most often used. However, the entry "IV" can be found already in the documents of the "Forme of Cury" manuscript dating back to 1390. Watch dials have traditionally used "IIII" instead of "IV" in most cases, mainly for aesthetic reasons: this spelling provides visual symmetry with the numbers "VIII" on the opposite side, and the reversed "IV" is more difficult to read than "IIII". There is also a version that IV was not written on the dial because IV is the first letters of the name of the god Jupiter (IVPITER).

The smaller number can be written to the left of the larger one, then it should be subtracted from the larger one. In this case, only numbers denoting 1 or powers of 10 can be subtracted, and only the nearest two numbers in the number series to the subtracted (that is, the subtracted, multiplied by 5 or 10) can act as a minuend. Repetitions of a smaller number are not allowed. Thus, there is only six options using the "rule of subtraction":

  • IV = 4
  • IX = 9
  • XL=40
  • XC = 90
  • CD=400
  • CM=900

For example, the number 94 will be XCIV \u003d 100 - 10 + 5 - 1 \u003d 94 - the so-called "subtraction rule" (appeared in the era of late antiquity, and before that the Romans wrote the number 4 as IIII, and the number 40 as XXXX).

It should be noted that other methods of "subtraction" are not allowed; thus, the number 99 should be written as XCIX, but not as IC. However, nowadays, in some cases, a simplified notation of Roman numbers is also used: for example, in Microsoft Excel, when converting Arabic numerals to Roman using the “ROMAN ()” function, you can use several types of representation of numbers, from classical to highly simplified (for example, the number 499 can be written as CDXCIX, LDVLIV, XDIX, VDIV, or ID). The simplification is that to reduce any digit, any other digit can be written to the left of it:

Cases of such notation of numbers (usually years) are often found in the credits of US television series. For example, for the year 1998: IIMM instead of MCMXCVIII.

Application

Autograph of B. N. Yeltsin November 10, 1988. The month is indicated in Roman numerals. Roman numerals for the day of the week on a shop window in Vilnius
  • Ordinal number of the monarch
  • Corps number in the Armed Forces
  • Blood group on the patches of the uniform of the military personnel of the Armed Forces of the Russian Federation
  • Base of homeopathic dilutions (Conium X3, Aconium C200, etc.).
  • In mathematical analysis, the number of the derivative above the third is sometimes written in Roman numerals.

Roman numerals were widely used in the USSR when indicating the date to indicate the month of the year, for example: 11 / III-85 or 9.XI.89, this can be seen on many archival documents of those times. In a similar way, through a slash, they also wrote down the date of the lesson in class journals, for example: 24/II. A special format was often used to indicate dates of life and death on tombstones, where the month of the year was also indicated by Roman numerals, for example: 18 6 X I I 78 ∼ 19 5 I I I 53 (\displaystyle 18(\frac (6)(XII))78\sim 19 (\frac (5)(III))53) . A similar format was used in medical certificates in the 1970s and 1980s.

With the transition to computer processing of information, date formats based on Roman numerals have practically fallen out of use.

In other languages, the scope of Roman numerals may differ. In Western countries, the number of the year is often written in Roman numerals, for example, on the gables of buildings and in the credits of film and video products.

In modern Lithuania, on road signs, on shop windows, on signboards of enterprises, days of the week can be indicated by Roman numerals.

Unicode

І · Ӏ · I · I · l · ﺍ‎‎ · ו‎‎ · Ι · ǀ · | ɪ 丨 Symbols with a similar style: V V ∨ ⋁ ⋎ Symbols with a similar style: X Χ X ㄨ Symbols with a similar style: L Լ Symbols with a similar style: C C Ϲ င A symbol with a similar style: D Symbols with a similar style: M Μ M Ϻ Symbols with a similar style: ʕ · Ҁ · Ϟ · Ϛ · Ⴚ

Numeric forms(English) Number Forms) in the area of ​​characters with codes from U+2160 to U+2188. For example, MCMLXXXVIII can be represented in the form ⅯⅭⅯⅬⅩⅩⅩⅧ. This range includes both lowercase and uppercase digits for the numbers 1 (Ⅰ or I) to 12 (Ⅻ or XII), including combined glyphs for compound numbers such as 8 (Ⅷ or VIII), mainly for ensuring compatibility with East Asian character sets in industry standards such as JIS X 0213, where these characters are defined. Combined glyphs are used to represent numbers that were previously made up of single characters (for example, Ⅻ instead of its representation as Ⅹ and Ⅱ). In addition, glyphs exist for archaic 1000, 5000, 10,000, big reverse C (Ɔ), late 6 (ↅ, similar to the Greek stigma: Ϛ), early 50 (ↆ, similar to down arrow ↓⫝⊥), 50,000, and 100,000. It should be noted that the small back c, ↄ is not included in Roman numeral characters, but is included in the Unicode standard as the uppercase Claudian letter Ↄ.

Unicode Roman Numerals Code 0 1 2 3 4 5 6 7 8 9 A B C D E F Value 1 2 3 4 5 6 7 8 9 10 11 12 50 100 500 1000 U+2160 U+2170 Value 1000 5000 10000 100 6 50 50,000 100,000 U+2180

Displaying all of these characters requires software that supports the Unicode standard and a font that contains the corresponding glyphs (such as the Universalia font).

Regular Expressions

The regular expression for checking Roman numerals is ^(M(0,3))(D?C(0,3)|C)(L?X(0,3)|X)(V?I(0,3)| I)$ In Perl, you can use the regular expression m/\b((?:M(0,3)?(?:D?C(0,3)|C)?(?:L ?X(0,3)|X)?(?:I(0,3)?V?I(0,3)|I)))\b/gs.

transformation

To convert numbers written in Arabic numerals to Roman, special functions are used. For example, in the Russian version of Microsoft Excel, there is a function for this ROMAN ROMAN(argument).

JavaScript conversion functions var arab = ; var roman = ["I","IV","V","IX","X","XL","L","XC","C","CD","D","CM ","M"]; function arabToRoman(number) ( if(!number) return ""; var ret = ""; var i = arab.length - 1; while(number > 0) ( if(number >= arab[i]) ( ret + = roman[i]; number -= arab[i]; ) else ( i--; ) ) return ret; ) function romanToArab(str) ( str = str.toUpperCase(); var ret = 0; var i = arab .length - 1;var pos = 0;while(i >= 0 && pos< str.length) { if(str.substr(pos, roman[i].length) == roman[i]) { ret += arab[i]; pos += roman[i].length; } else { i--; } } return ret; } Аналогичные функции на Си (C89): #include const int arabar = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000}; const char *romanar = { "I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"}; char *arab2roman(unsigned short int arab) { static char roman; const int m = sizeof(arabar)/sizeof(int)-1, arabmax=arabar[m]; const char romanmax=romanar[m]; int i, n; if(!arab) { *roman=0; return roman; } i=0; while(arab>arabmax) ( roman = romanmax; arab -= arabmax; ) n=m; while(arab > 0) ( if(arab >= arabar[n]) ( roman = romanar[n]; if(n&1) roman = romanar[n]; arab -= arabar[n]; ) else n--; ) roman[i]=0; return roman; ) unsigned short int roman2arab(char *roman) ( const int m = sizeof(arabar)/sizeof(int)-1; unsigned short int arab; int len, n, i, pir; len=strlen(roman); arab= 0; n=m; i=0; while(n >= 0 && i< len) { pir=n&1; if(roman[i] == romanar[n] && (!pir || roman == romanar[n])) { arab += arabar[n]; i += 1+pir; } else n--; } return arab; } Программа перевода арабских цифр в римские и наоборот type str2 = string; const Rims: array of str2 = ("M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"," "); Arab: array of integer = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1, 0); var N, NI, I, J: integer; S: string; function Arab2Rim(N: integer) : string; var S: string; I: integer; begin S:= ""; I:=1; while N >0 do begin while Arab[I]"" do begin while Rims[I] = Copy(S, 1, Length(Rims[I])) do begin S:= Copy(S, 1+Length(Rims[I]) , 255); N:= N + Arab[I]end; I:=I+1end; Rim2Arab:= Nend; begin WriteLn("Translation from Arabic to Roman numerals. 1999 B_SA"); ( Write("Enter a number to convert:"); ReadLn(N);) for NI:= 26 to 46 do WriteLn(NI," = ",Arab2Rim(NI)," back ", Rim2Arab(Arab2Rim(NI)) ); end. Arabic to Roman conversion function in Pascal function Arab2Roman(arab:integer):string; var i:integer; d:integer; arab_str:string; arab_len:integer; begin Result:= ""; arab_str:= IntToStr(arab); arab_len:= Length(arab_str); for i:= 0 to arab_len-1 do begin d:= StrToInt(String(arab_str)); if (d+1) mod 5 = 0 then Result:= Copy("IXCM", 1+i, 1) + Copy("VXLCDM", i*2 + (d+1) div 5, 1) + Result else Result:= Copy("VLD", 1+i, d div 5) + Copy("IIIXXXCCCMMM", 1+i*3, (d mod 5)) + Result; end; end;

BASIC Arabic to Roman conversion function (shortest code) 10 INPUT "ARABIC NUMBER: "; A$ 20 FOR I=0 TO LEN(A$)-1 30 X=VAL(MID$(A$,LEN(A$)-I,1)) 40 IF X=4 OR X=9 THEN B$= MID$("IXCM",I+1,1)+MID$("VXLCDM",I*2+(X+1)/5,1)+B$ 50 IF X4 AND X case 1999) to roman on XPath string-join(for $num in (1999) return (("","M","MM","MMM")[($num idiv 1000) mod 10+1], ( "","C","CC","CCC","CD","D","DC","DCC","DCCC","CM")[($num idiv 100) mod 10+1 ], ("","X","XX","XXX","XL","L","LX","LXX","LXXX","XC")[($num idiv 10) mod 10+1], ("","I","II","III","IV","V","VI","VII","VIII","IX")[$num mod 10 +1]), "") A function to convert an Arabic number (in this case 1999) to a Roman number in Perl use strict; use warnings; my $n = 1999; my $nums = [ ["", qw(I II III IV V VI VII VIII IX) ], ["", qw(X XX XXX XL L LX LXX LXXX XC) ], ["", qw(C CC CCC CD D DC DCC DCCC CM) ], ["", qw(M MM MMM) ] ]; my $i = 0; my @res = (); push @res, ($nums->[$i++][ ($n % 10, $n = int($n / 10)) ]) for 0 .. 3; print reverse @res; Class for converting an Arabic number (from 1 to 3999) into a Roman number in Java import java.util.*; public class IntegerConverter ( public static String intToRoman(int number) ( if (number >= 4000 || number iterator = units.descendingKeySet().iterator(); while (iterator.hasNext()) ( Integer key = iterator.next( ); while (number >= key) ( number -= key; result.append(units.get(key)); ) ) return result.toString(); ) private static final NavigableMap units; static ( NavigableMap initMap = new TreeMap<> (); initMap.put(1000, "M"); initMap.put(900, "CM"); initMap.put(500, "D"); initMap.put(400, "CD"); initMap.put(100, "C"); initMap.put(90, "XC"); initMap.put(50, "L"); initMap.put(40, "XL"); initMap.put(10, "X"); initMap.put(9, "IX"); initMap.put(5, "V"); initMap.put(4, "IV"); initMap.put(1, "I"); units = Collections.unmodifiableNavigableMap(initMap); ) ) Extension class for converting Roman numbers to Arabic and vice versa, on CSharp /// /// The class is intended for converting Arabic numbers to Roman numbers and vice versa /// /// /// The class initially contains the alphabet of Roman numbers that can determine Arabic numbers from 1 to 39999 /// If you need to expand the range, you can define additional notation for Roman numerals using /// the Basic Roman Numerals field public static class Roman Numerals ( /// /// Alphabet of basic Roman numerals /// The alphabet is built in the form Dictionary key is an Arabic number (int), value is its corresponding /// Roman number (string) /// /// /// Contains the Roman notation for Arabic numbers 1*,4*,5*,9* - where "*" represents 0...N zeros /// When created, it contains the designation of numbers from 1 to 10000 (I...ↂ) can initially be converted to roman format from 1 to 39999. /// If you want to be able to If you want to work with a large number of Roman numerals, then you should add additional symbols to the /// list starting from 40000 without skipping the elements 1*,4*,5*,9*. /// public static SortedList BasicRomanNumbers ( get; set; ) static RomanNumber() ( BasicRomanNumbers = new SortedList(17); BasicRomanNumbers.Add(1, "I"); BasicRomanNumbers.Add(4, "IV"); BasicRomanNumbers. Add(5, "V"); Basic Roman Numbers.Add(9, "IX"); Basic Roman Numbers.Add(10, "X"); Basic Roman Numbers.Add(40, "XL"); Basic Roman Numbers.Add(50, "L "); BaseRomanNumbers.Add(90, "XC"); BaseRomanNumbers.Add(100, "C"); BaseRomanNumbers.Add(400, "CD"); BaseRomanNumbers.Add(500, "D"); BaseRomanNumbers.Add (900, "CM"); Basic Roman Numbers.Add(1000, "M"); Basic Roman Numbers.Add(4000, "Mↁ"); Basic Roman Numbers.Add(5000, "ↁ"); Basic Roman Numbers.Add(9000, "Mↂ" ); BasicRomanNumbers.Add(10000, "ↂ"); ) /// /// Calculates the maximum possible Roman number for the current Roman numeral alphabet. /// /// Maximum possible Roman number public static uint MaximumRomanNumber() ( int lastNumber = BaseRomanNumbers. keys.Last(); int numberWithoutZeros = int.Parse(lastNumber.ToString().Replace("0","\0")); int pre=0; switch (numberNoZeros) ( case 1: pre = lastNumber * 4 - 1; break; case 4: case 9: pre = lastNumber; break; case 5: pre = lastNumber + lastNumber / 5 * 3; break; default: break; ) return uint.Parse(prev.ToString().Replace("0", "9"));; ) /// /// Converts an integer to a Roman number /// /// Arabic number to be converted to Roman notation /// Generated when a number equal to "0" is passed as a parameter /// or a number greater than the maximum Roman number. /// A string representing a Roman number public static string ArabicRoman(this int numberArab) ( StringBuilder numberRoman = new StringBuilder(); //Exclude the "-" sign from the Arabic number and make it the first character of the Roman number if (numberArab< 0) { числоРимское.Append("-"); числоАраб = -числоАраб; } if (числоАраб == 0) throw new ArgumentOutOfRangeException("числоАраб", числоАраб, "Недопустимое значение аргумента: римские числа не могут быть равными\"0\""); else if (числоАраб >MaxRomanNumber()) throw new ArgumentOutOfRangeException("numberArab", numberArab, string.Format("Invalid argument value: Cannot set Roman number greater than (0)", MaxRomanNumber())); //Decompose the Arabic number into its constituent Roman numbers and combine them into one string var requiredBasicRomanNumbers = from to in BasicRomanNumbers.Keys where k = 1) ( numberArab -= current; numberRoman.Append(BasicRomanNumbers[current]); ) ) return numberRoman .ToString(); ) /// /// Converts a Roman number to Arabic /// /// A Roman number to be converted to an int type /// Generated when a non-Roman number is passed as a parameter /// An integer representing the Arabic notation roman number public static int roman to arabic(this string roman number) ( int arabic number = 0; sbyte negative = 1; string roman = roman number.Trim(); if (roman == "-") ( negative = -1; roman = roman. Substring(1); ) StringBuilder RomanNumber template = new StringBuilder(); foreach (int to in BaseRomanNumbers.Keys) ( int index = BaseRomanNumbers.Keys.IndexOf(to); string quantifier="?"; if (index == 0 | |(index % 4) == 0) quantifier="(0,3)";RomanNumber template.Insert(0, string.Format("(?((1))(2))?", to.ToString() , BaseRomanNumbers[k], quantifier)); ) //Ignore case + match must start at the beginning of the string patternRomanNumbers.Insert(0, "(?i)^"); //Match must be found at the end of the string patternP ImskogoNumber.Append("$"); // Simplified check. Does not check for errors such as IVII if (!Regex.IsMatch(Roman, RomanNumber template.ToString())) throw new FormatException(string.Format("Text \"(0)\" is not a Roman number",Roman number)); Match number = Regex.Match(Roman, RomanNumber template.ToString()); foreach (int to in BaseRomanNumbers.Keys) ( numberArab += number.Groups[to.ToString()].Length / BaseRomanNumbers[to].Length * to; ) return numberArab * negative; ) )

Roman numerals are:

Roman numerals Clock-chimes of the Spasskaya Tower Number systems in culture Indo-Arabic number systemEast Asian number systemsAlphabetical number systemsOther systems Positional number systems Mixed number systems Non-positional number systems
Arabic
Indian
Tamil
Burmese
Khmer
Lao
Mongolian
Thai
Chinese
Japanese
Suzhou
Korean
Vietnamese
counting sticks
Abjadia
Armenian
Aryabhata
Cyrillic
Greek
Ethiopian
Jewish
Catapayadi
Babylonian
Egyptian
Etruscan
Roman
Attic
Kipu
Mayskaya
Decimal number system (10)
2, 3, 4, 5, 6, 7, 8, 9, 12, 16, 20, 60
Negative number system
Symmetric number system
Fibonacci number system
Unit (unary) number system
List of number systems

Roman numerals- numbers used by the ancient Romans in their non-positional number system.

Natural numbers are written by repeating these digits. At the same time, if a large number is in front of a smaller one, then they are added (the principle of addition), if the smaller one is in front of the larger one, then the smaller one is subtracted from the larger one (the principle of subtraction). The last rule applies only to avoid the fourfold repetition of the same figure.

Roman numerals appeared 500 BC among the Etruscans.

Numbers

Roman numerals

In Russian, there are mnemonic rules for fixing the alphabetic designations of numbers in descending order:

M s D arim FROM face-to-face L imony, X vatite V sem I X.

M s D we eat C advice L ish X okay V well-mannered I individuals

Respectively M, D, C, L, X, V, I

Examples

Number Roman designation Note

To correctly write large numbers in Roman numerals, you must first write down the number of thousands, then hundreds, then tens, and finally units.

In this case, some of the numbers (I, X, C, M) may be repeated, but no more than three times; thus, they can be used to write any integer no more than 3999(MMMCMXCIX). In the early periods, there were signs to indicate larger numbers - 5000, 10,000, 50,000 and 100,000 [ source unspecified 683 days] (then the maximum number according to the mentioned rule is 399,999). When writing numbers in the Roman numeral system, the smaller digit may be to the right of the larger one; in this case it is added to it. For example, the number 283 in Roman is written as CCLXXXIII, that is, 100+100+50+30+3=283. Here, the number representing a hundred is repeated twice, and the numbers representing ten and one, respectively, are repeated three times.

Example: number 1988. One thousand M, nine hundred CM, eight tens LXXX, eight units VIII. Let's write them together: MCMLXXXVIII.

Quite often, to highlight the numbers in the text, a line was drawn over them: LXIV. Sometimes the line was drawn both above and below: XXXII- in particular, it is customary to highlight Roman numerals in Russian handwritten text (this is not used in typographic typesetting due to technical complexity). For other authors, the overline could indicate an increase in the value of the figure by 1000 times: VM = 6000.

Tissot watches with the traditional spelling "IIII"

It was only in the 19th century that the number “four” was written universally as “IV”, before that the record “IIII” was most often used. However, the entry "IV" can be found already in the documents of the "Forme of Cury" manuscript dating back to 1390. Watch dials have traditionally used "IIII" instead of "IV" in most cases, mainly for aesthetic reasons: this spelling provides visual symmetry with the numbers "VIII" on the opposite side, and the reversed "IV" is more difficult to read than "IIII".

The smaller number can be written to the left of the larger one, then it should be subtracted from the larger one. In this case, repetitions of a smaller digit are not allowed. In Roman, the number 94 will be XCIV=100-10+5-1=94 - the so-called "subtraction rule" (appeared in the era of late antiquity, and before that the Romans wrote the number 4 as IIII, and the number 40 as XXXX). There are six ways to use the "subtraction rule":

  • IV = 4
  • IX = 9
  • XL=40
  • XC = 90
  • CD=400
  • CM=900

It should be noted that other methods of "subtraction" are not allowed; thus, the number 99 should be written as XCIX, but not as IC. However, nowadays, in some cases, a simplified notation of Roman numbers is also used: for example, in Microsoft Excel, when converting Arabic numerals to Roman using the “ROMAN ()” function, you can use several types of representation of numbers, from classical to highly simplified (for example, the number 499 can be written as CDXCIX, LDVLIV, XDIX, VDIV, or ID). The simplification is that to reduce any digit, any other digit can be written to the left of it:

  • 999. Thousand (M), subtract 1 (I), get 999 (IM) instead of CMXCIX. Consequence: 1999 - MIM instead of MCMXCIX
  • 95. One hundred (C), subtract 5 (V), get 95 (VC) instead of XCV
  • 1950: One thousand (M), subtract 50 (L), we get 950 (LM). Consequence: 1950 - MLM instead of MCML

Roman numerals can also be used to write large numbers. To do this, a line is placed above those numbers that represent thousands, and a double line is placed above the numbers that represent millions. For example, the number 123123 would look like this:

And a million is like I, but not with one, but with two features at the head: I

Application

Autograph of B. N. Yeltsin November 10, 1988. The month is indicated in Roman numerals.

In Russian, Roman numerals are used in the following cases:

  • Century or millennium number: XIX century, II millennium BC. e.
  • The serial number of the monarch: Charles V, Catherine II.
  • Volume number in a multi-volume book (sometimes numbers of book parts, sections or chapters).
  • In some editions - page numbers with the preface to the book, so as not to correct references inside the main text when changing the preface.
  • Antique watch dial markings.
  • Other important events or list items, for example: V postulate of Euclid, World War II, XX Congress of the CPSU, Games of the XXII Olympiad, etc.
  • Valency of chemical elements.
  • The ordinal number of a step in the scale.

Roman numerals were widely used in the USSR when indicating the date to indicate the month of the year: 11 / III-85 or 9.XI.89. To indicate the dates of life and death on tombstones, a special format was often used, where the month of the year was also indicated by Roman numerals. With the transition to computer processing of information, date formats based on Roman numerals have practically fallen out of use.

In other languages, the scope of Roman numerals may have some peculiarities, for example, in Western countries, Roman numerals sometimes record the year number.

If we expand the numbers graphically, we get the following:

I I V I I X I I V I I X I I V I I X I I V I I X I I V I I L I I V I I X
1 I
2 I
3 I I
4 I V
5 V
6 V I
7 V I
8 V I I
9 I X
10 X
11 X I
12 X I
13 X I I
14 X I V
15 X V
16 X V I
17 X V I
18 X V I I
19 X I X
20 X X
21 X X I
22 X X I
23 X X I I
24 X X I V
25 X X V
26 X X V I
27 X X V I
28 X X V I I
29 X X I X
30 X X X
31 X X X I
32 X X X I
33 X X X I I
34 X X X I V
35 X X X V
36 X X X V I
37 X X X V I
38 X X X V I I
39 X X X I X
40 X L
41 X L I
42 X L I
43 X L I I
44 X L I V
45 X L V
46 X L V I
47 X L V I
48 X L V I I
49 X L I X
50 L etc. up to MMMCMXCIX (3999)

Unicode

The Unicode standard recommends using regular Latin letters to represent Roman numerals. However, the standard also includes special characters for Roman numerals as part of Numeric forms(English) Number Forms) in the area of ​​characters with codes from U+2160 to U+2188. For example, MCMLXXXVIII can be represented in the form ⅯⅭⅯⅬⅩⅩⅩⅧ. This range includes both lowercase and uppercase digits from 1 (Ⅰ or I) to 12 (Ⅻ or XII), including combined glyphs for compound numbers such as 8 (Ⅷ or VIII), mainly for compatibility with East Asian character sets in industry standards such as JIS X 0213, where these characters are defined. Combined glyphs are used to represent numbers that were previously made up of single characters (for example, Ⅻ instead of its representation as Ⅹ and Ⅱ). In addition, glyphs exist for archaic 1000, 5000, 10,000, big reverse C (Ɔ), late 6 (ↅ, similar to the Greek stigma: Ϛ), early 50 (ↆ, similar to to an arrow pointing down. Template:Wmwwyairrufctr5ke4fuyUnicode), 50,000, and 100,000. Note that the small backward c, ↄ is not included in Roman numeral characters, but is included in the Unicode standard as the uppercase Claudian letter Ↄ.

Unicode Roman Numerals Code 0 1 2 3 4 5 6 7 8 9 A B C D E F Value 1 2 3 4 5 6 7 8 9 10 11 12 50 100 500 1000 U+2160 U+2170 Value 1000 5000 10000 - - 6 50 50 000 100 000 U+2160! U+2180

Displaying all of these characters requires software that supports the Unicode standard and a font that contains the corresponding glyphs.

Regular Expressions

The regular expression for checking Roman numerals is "^(?i)M(0,3)(D?C(0,3)|C)(L?X(0,3)|X)(V?I(0, 3)|I)$". In Perl, you can use the regular expression "m/((?i)M(0,3)(D?C(0,3)|C)(L?X(0,3)|X )(I|V?I(0.3)))/g".

transformation

To convert numbers written in Arabic numerals to Roman, special functions are used. For example, in the Russian version of Microsoft Excel, there is a function for this ROMAN(argument), in the English version of Microsoft Excel and in any version of OpenOffice.org Calc this function is called ROMAN(argument).

JavaScript conversion functions var arab = ; var roman = ["I","IV","V","IX","X","XL","L","XC","C","CD","D","CM ","M"]; function arabToRoman(number) ( if(!number) return ""; var ret = ""; var i = arab.length - 1; while(number > 0) ( if(number >= arab[i]) ( ret + = roman[i]; number -= arab[i]; ) else ( i--; ) ) return ret; ) function romanToArab(str) ( str = str.toUpperCase(); var ret = 0; var i = arab .length - 1;var pos = 0;while(i >= 0 && pos< str.length) { if(str.substr(pos, roman[i].length) == roman[i]) { ret += arab[i]; pos += roman[i].length; } else { i--; } } return ret; } Аналогичные функции на Си (C89): #include const int arabar = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000}; const char *romanar = { "I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"}; char *arab2roman(unsigned short int arab) { static char roman; const int m = sizeof(arabar)/sizeof(int)-1, arabmax=arabar[m]; const char romanmax=romanar[m]; int i, n; if(!arab) { *roman=0; return roman; } i=0; while(arab>arabmax) ( roman = romanmax; arab -= arabmax; ) n=m; while(arab > 0) ( if(arab >= arabar[n]) ( roman = romanar[n]; if(n&1) roman = romanar[n]; arab -= arabar[n]; ) else n--; ) roman[i]=0; return roman; ) unsigned short int roman2arab(char *roman) ( const int m = sizeof(arabar)/sizeof(int)-1; unsigned short int arab; int len, n, i, pir; len=strlen(roman); arab= 0; n=m; i=0; while(n >= 0 && i< len) { pir=n&1; if(roman[i] == romanar[n] && (!pir || roman == romanar[n])) { arab += arabar[n]; i += 1+pir; } else n--; } return arab; } Программа перевода арабских цифр в римские и наоборот type str2 = string; const Rims: array of str2 = ("M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"," "); Arab: array of integer = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1, 0); var N, NI, I, J: integer; S: string; function Arab2Rim(N: integer) : string; var S: string; I: integer; begin S:= ""; I:=1; while N >0 do begin while Arab[I]"" do begin while Rims[I] = Copy(S, 1, Length(Rims[I])) do begin S:= Copy(S, 1+Length(Rims[I]) , 255); N:= N + Arab[I]end; I:=I+1end; Rim2Arab:= Nend; begin WriteLn("Translation from Arabic to Roman numerals. 1999 B_SA"); ( Write("Enter a number to convert:"); ReadLn(N);) for NI:= 26 to 46 do WriteLn(NI," = ",Arab2Rim(NI)," back ", Rim2Arab(Arab2Rim(NI)) ); end. Arabic to Roman conversion function in Pascal function Arab2Roman(arab:integer):string; var i:integer; d:integer; arab_str:string; arab_len:integer; begin Result:= ""; arab_str:= IntToStr(arab); arab_len:= Length(arab_str); for i:= 0 to arab_len-1 do begin d:= StrToInt(String(arab_str)); if (d+1) mod 5 = 0 then Result:= Copy("IXCM", 1+i, 1) + Copy("VXLCDM", i*2 + (d+1) div 5, 1) + Result else Result:= Copy("VLD", 1+i, d div 5) + Copy("IIIXXXCCCMMM", 1+i*3, d mod 5) + Result; end; end;

A distinctive feature of this algorithm is that it does not use arrays (unless, of course, the string is considered an array of characters).

BASIC Arabic to Roman conversion function (shortest code) 10 INPUT "ARABIC NUMBER: "; A$ 20 FOR I=0 TO LEN(A$)-1 30 X=VAL(MID$(A$,LEN(A$)-I,1)) 40 IF X=4 OR X=9 THEN B$= MID$("IXCM",I+1,1)+MID$("VXLCDM",I*2+(X+1)/5,1)+B$ 50 IF X4 AND X case 1999) to roman on XPath string-join(for $num in (1999) return (("","M","MM","MMM")[($num idiv 1000) mod 10+1], ( "","C","CC","CCC","CD","D","DC","DCC","DCCC","CM")[($num idiv 100) mod 10+1 ], ("","X","XX","XXX","XL","L","LX","LXX","LXXX","XC")[($num idiv 10) mod 10+1], ("","I","II","III","IV","V","VI","VII","VIII","IX")[$num mod 10 +1]), "") A function to convert an Arabic number (in this case 1999) to a Roman number in Perl use strict; use warnings; my $n = 1999; my $nums = [ ["", qw(I II III IV V VI VII VIII IX) ], ["", qw(X XX XXX XL L LX LXX LXXX XC) ], ["", qw(C CC CCC CD D DC DCC DCCC CM) ], ["", qw(M MM MMM) ] ]; my $i = 0; my @res = (); push @res, ($nums->[$i++][ ($n % 10, $n = int($n / 10)) ]) for 0 .. 3; print reverse @res; Class for converting Arabic number (from 1 to 3999) to Roman number in Java class ArabRome ( private int arabBase = (1000, 500, 100, 50, 10, 5, 1); private String romeBase = ("M", "D" , "C", "L", "X", "V", "I"); public String ArabToRome(int arab) ( int result = 0; int remainder = 0; String resultRome = ""; for(short i = 0; i0 && result=4 && result Extension class for converting Roman numbers to Arabic and vice versa, on CSharp /// /// The class is intended for converting Arabic numbers to Roman numbers and vice versa /// /// /// The class was originally contains an alphabet of Roman numerals capable of defining Arabic numerals from 1 to 39999 /// If you need to expand the range, you can define additional notation for Roman numerals using /// the Basic Roman Numbers field public static class Roman Number ( /// /// Basic Roman Numbers Alphabet numbers /// The alphabet is built in the form of a dictionary.The key of the dictionary is an Arabic number (int), the value is its corresponding /// Roman number (string) t Roman notation for Arabic numbers 1*,4*,5*,9* - where "*" represents 0...N zeros /// When created, it contains the notation for numbers from 1 to 10000 (I...ↂ) Since one character cannot /// occur more than three times in a Roman number, you can initially convert numbers from 1 to 39999 into Roman format. /// If you want to be able to work with a large number of Roman numbers, then you must add to list /// additional designations starting from 40000 without skipping elements 1*,4*,5*,9*. /// public static SortedList BasicRomanNumbers ( get; set; ) static RomanNumber() ( BasicRomanNumbers = new SortedList(17); BasicRomanNumbers.Add(1, "I"); BasicRomanNumbers.Add(4, "IV"); BasicRomanNumbers. Add(5, "V"); Basic Roman Numbers.Add(9, "IX"); Basic Roman Numbers.Add(10, "X"); Basic Roman Numbers.Add(40, "XL"); Basic Roman Numbers.Add(50, "L "); BaseRomanNumbers.Add(90, "XC"); BaseRomanNumbers.Add(100, "C"); BaseRomanNumbers.Add(400, "CD"); BaseRomanNumbers.Add(500, "D"); BaseRomanNumbers.Add (900, "CM"); Basic Roman Numbers.Add(1000, "M"); Basic Roman Numbers.Add(4000, "Mↁ"); Basic Roman Numbers.Add(5000, "ↁ"); Basic Roman Numbers.Add(9000, "Mↂ" ); BasicRomanNumbers.Add(10000, "ↂ"); ) /// /// Calculates the maximum possible Roman number for the current Roman numeral alphabet. /// /// Maximum possible Roman number public static uint MaximumRomanNumber() ( int lastNumber = BasicRomanNumbers.Keys.Last(); int numberWithoutZeros = int.Parse(lastNumber.ToString().Replace("0","\0 ")); int tentative=0; switch(NumberNoZeros) ( case 1: tentative = lastNumber * 4 - 1; break; case 4: case 9: tentative = lastNumber; break; case 5: tentative = lastNumber + lastNumber / 5 * 3; break; default: break; ) return uint.Parse(pre.ToString().Replace("0", "9"));; ) /// /// Converts integer to Roman numeral /// / // Arabic number to be converted to Roman notation /// Generated when a number equal to "0" /// or a number greater than the maximum Roman number is passed as a parameter. /// A string representing a Roman number public static string ArabicRoman(this int numberArab) ( StringBuilder numberRoman = new StringBuilder(); //Exclude the "-" sign from the Arabic number and make it the first character of the Roman number if (numberArab< 0) { числоРимское.Append("-"); числоАраб = -числоАраб; } if (числоАраб == 0) throw new ArgumentOutOfRangeException("числоАраб", числоАраб, "Недопустимое значение аргумента: римские числа не могут быть равными\"0\""); else if (числоАраб >MaxRomanNumber()) throw new ArgumentOutOfRangeException("numberArab", numberArab, string.Format("Invalid argument value: Cannot set Roman number greater than (0)", MaxRomanNumber())); //Decompose the Arabic number into its constituent Roman numbers and combine them into one string var requiredBasicRomanNumbers = from to in BasicRomanNumbers.Keys where k = 1) ( numberArab -= current; numberRoman.Append(BasicRomanNumbers[current]); ) ) return numberRoman .ToString(); ) /// /// Converts a Roman number to Arabic /// /// A Roman number to be converted to an int type /// Generated when a non-Roman number is passed as a parameter /// An integer representing the Arabic notation roman number public static int roman to arabic(this string roman number) ( int arabic number = 0; sbyte negative = 1; string roman = roman number.Trim(); if (roman == "-") ( negative = -1; roman = roman. Substring(1); ) StringBuilder RomanNumber template = new StringBuilder(); foreach (int to in BaseRomanNumbers.Keys) ( int index = BaseRomanNumbers.Keys.IndexOf(to); string quantifier="?"; if (index == 0 | |(index % 4) == 0) quantifier="(0,3)";RomanNumber template.Insert(0, string.Format("(?((1))(2))?", to.ToString() , BaseRomanNumbers[k], quantifier)); ) //Ignore case + match must start at the beginning of the string patternRomanNumbers.Insert(0, "(?i)^"); //Match must be found at the end of the string patternP ImskogoNumber.Append("$"); // Simplified check. Does not check for errors such as IVII if (!Regex.IsMatch(Roman, RomanNumber template.ToString())) throw new FormatException(string.Format("Text \"(0)\" is not a Roman number",Roman number)); Match number = Regex.Match(Roman, RomanNumber template.ToString()); foreach (int to in BaseRomanNumbers.Keys) ( numberArab += number.Groups[to.ToString()].Length / BaseRomanNumbers[to].Length * to; ) return numberArab * negative; ) )

Notes

  1. Unicode Standard, 15.3
  2. 1 2 Unicode Number Forms
  3. Perry, David J. Proposal to Add Additional Ancient Roman Characters to UCS.
  4. For the first two lines
  5. "Science and Life" N12 1986 p.95, V. Ptitsyn, Moscow
  6. Author - Kuznetsov Evgeny A.
  7. Author - Evgeny A. Kuznetsov, 1992

see also

  • Symbols of ancient Roman monetary and weight units
Technical note: Due to technical limitations, some browsers cannot display the special characters used in this article. Such characters may appear as boxes, question marks, or other meaningless characters, depending on your web browser, operating system, and installed fonts. Even if your browser is capable of interpreting UTF-8 and you have installed a font that supports a large Unicode range, such as Code2000, Arial Unicode MS, Lucida Sans Unicode or one of the free Unicode fonts, you may need to use a different browser as browser capabilities often differ in this area. Categories:
  • Numbers
  • Number systems

What do the Roman letters L C D M mean?

These are numbers! - in the Roman numbering system, based on the use of Latin letters, became one of the good reasons for replacing it with a more convenient decimal number system in this regard
In ascending order, these letters represent the following integers: I - one, V - five, X - ten, L - fifty, C - one hundred, D - five hundred, M - one thousand.
Roman numerals
The Roman numbering system using letters has been common in Europe for two thousand years. Only in the late Middle Ages it was replaced by a more convenient decimal system of numbers, borrowed from the Arabs. But, until now, Roman numerals denote dates on monuments, time on clocks and (in the Anglo-American typographic tradition) pages of book prefaces. In addition, in Russian, it is customary to designate ordinal numbers with Roman numerals.
To designate numbers, 7 letters of the Latin alphabet were used: I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, M = 1000. Intermediate numbers were formed by adding several letters to the right or left. First, thousands and hundreds were written, then tens and ones. Thus, the number 24 was depicted as XXIV. The horizontal line above the symbol meant multiplication by a thousand.
Natural numbers are written by repeating these digits. At the same time, if a large number is in front of a smaller one, then they are added (the principle of addition), if the smaller one is in front of the larger one, then the smaller one is subtracted from the larger one (the principle of subtraction). The last rule applies only to avoid the fourfold repetition of the same figure. For example, I, X, C are placed respectively before X, C, M to denote 9, 90, 900 or before V, L, D to denote 4, 40, 400. For example, VI \u003d 5 + 1 \u003d 6, IV \u003d 5 - 1 = 4 (instead of IIII). XIX = 10 + 10 - 1 = 19 (instead of XVIIII), XL = 50 - 10 = 40 (instead of XXXX), XXXIII = 10 + 10 + 10 + 1 + 1 + 1 = 33, etc.
Performing arithmetic operations on multi-digit numbers in this notation is very inconvenient. The system of Roman numerals is not currently used, with the exception, in some cases, of the designation of centuries (XV century, etc.), years AD. e. (MCMLXXVII etc.) and months when indicating dates (for example, 1. V.1975), ordinal numbers, and sometimes derivatives of small orders, greater than three: yIV, yV, etc.
How are Roman numerals written? -//elhow.ru/ucheba/matematika/kak-pishutsja-rimskie-cifry
.437000.ru/info/rim.php
__________________________
The Latin alphabet became isolated around the 7th century BC. e. and originally included only 21 letters: A, B, C, D, E, F, Z, H, I, K, L, M, N, O, P, Q, R, S, T, V and X.
://ladyretryka.ru/?p=10980

What number does the Roman numeral M stand for?

What number does the Roman numeral M stand for?

Alsu - sh

I already answered a similar question (see here). Briefly, I would like to answer this one.

I repeat a little.

Roman numerals, and there are only 7 of them, are easy to remember. Here are the letters of these numbers in descending order: M, D, C, L, X, V, I:

As we see, The Roman numeral, which is the capital letter M, represents the number 1000.

Now we give examples of numbers that are written in Roman numerals:



Now let's write:

This year's number 2015 , for example, would be written like this: ММХV

1941 - MSMXXXXXXI

1945 - MCMXXXXXXV

2987 - MMCMLXXXVII

2001 - MMI

Zolotynka

If the Roman numeral M stands alone, by itself, then its value will be 1000.

But: if M is preceded by a smaller number, as, for example, in this example, CM, then this will mean: 1000-100=900.

If C comes after M, then you need to add, therefore the value is 1000 + 100 = 1010.

C, as we remember, stands for a hundred.

Main rules: you can not put more than one smaller number before a larger number for subtraction. So, IIV does not mean 3.

In addition, tens, hundreds and thousands should be separated as separate elements (a smaller number cannot differ from a larger one by more than 10 times). This means that 99 is XCIX, 90 + 9, but can never be written as IC. Likewise, 999 cannot be an IM, and 1999 cannot be a MIM, and so on.

Natashau

We are used to using Arabic numerals. But the Roman ones still exist and are widely used, which are already almost two and a half thousand years old. Roman numerals are represented as letters. There are only seven such letters: I, V, X, L, C, D, M. Their specific location indicates the number. If these numbers are located separately from the rest, then they have the following values: I - 1, V - 5, X - 10, L - 50, C - 100, D - 500, M - 1000.

Beautiful glade

Roman numeral M (aka letter) means number 1000 .

In Roman calculus, very few letters are used to write numbers, there are only 7 of them. But to write large numbers in Roman letters, you need to add and subtract one number from another, which is not so easy without practice.

In Arabic, 10 characters are used to denote numbers and they can write any number without mathematical operations.

The Latin letter M in Roman numerals means "thousand", from the Latin mille..

And now this prefix is ​​​​widely used, for example, ppm - literally "from a thousand", and the word "million" also came from there, literally translated "a huge thousand", "thousand", and it's interesting how this word appeared, but that's another story ..

Athanasius44

Roman numerals are now rarely used anywhere; they have been supplanted by more convenient Arabic ones. Basically, they are used to name centuries, for example, the 5th century, the 12th century, and even in rare cases.

The letter M was the Roman word for a thousand. Two adjacent letters MM mean two thousand, MMM three thousand, and then even more difficult and fun.

Moreljuba

The Roman numeral M, of course, is familiar to us as a letter, but in the Roman numeral system it is still a number. So it means exactly one thousand. and it originates from a Roman numeral from such a Latin word as mille.

Ludmila 1986

The ancient Romans used the letters of the Latin alphabet to represent numbers. Roman numerals appeared around 500 BC.

In many languages, Roman numerals are used to record the number of the century (millennium), mark the dials, in mathematical analysis, important events.


buzzing bee

Roman L, C, D, M are not as common as the rest, M means the number 1000, MM means 2000, and MMM means 3000.

For example, the year 2017 will be denoted by Roman numerals MMXVII, 2018 will be Roman numerals MMXVIII.


We recommend reading

Top