Roman number d. How do Roman numerals work?

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

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

Natural numbers are written by repeating these numbers. Moreover, if a larger number is in front of a smaller one, then they are added (the principle of addition), but if a smaller number 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 repeating the same number four times.

Roman numerals appeared around 500 BC among the Etruscans.

Numbers

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

M s D arim WITH face-to-face L imons, X vatit V seven I X.

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

To correctly write large numbers in Roman numerals, you must first write 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 to simplify things. The difference is that to reduce a digit, any digit can be written to the left of it:

  • 999. Thousand (M), subtract 1 (I), we 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), get 950 (LM). Consequence: 1950 - MLM instead of MCML

It was only in the 19th century that the number “four” was written down as “IV”; before that, the number “IIII” was most often used. However, the entry “IV” can already be found 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 "VIII" numerals on the opposite side, and an inverted "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.
  • Serial number of the monarch: Charles V, Catherine II.
  • The volume number in a multi-volume book (sometimes the numbers of parts of the book, sections or chapters).
  • In some publications - the numbers of sheets with the preface to the book, so as not to correct the links within the main text when the preface is changed.
  • Antique watch dial markings.
  • Other important events or bullet points, for example: Euclid's V postulate, World War II, XXII Congress of the CPSU, etc.

In other languages, the scope of application of Roman numerals may have specific features; for example, in Western countries, the year number is sometimes written in Roman numerals.

Roman numerals and Unicode

The Unicode standard defines characters to represent Roman numerals as part of Number Forms(English) Number Forms), in the area of ​​characters with codes U+2160 to U+2188. For example, MCMLXXXVIII can be represented in the form ⅯⅭⅯⅬⅩⅩⅩⅧ . This range includes both lowercase and uppercase numerals from 1 (Ⅰ or I) to 12 (Ⅻ or XII), including combination glyphs for composite numbers such as 8 (Ⅷ or VIII), primarily for compatibility with East Asian character sets in industry standards such as JIS X 0213, where these characters are defined. Combination glyphs are used to represent numbers that were previously composed of individual characters (for example, Ⅻ instead of its representation as Ⅹ and Ⅱ). In addition to this, glyphs exist for the archaic forms of 1000, 5000, 10,000, major reverse C (Ɔ), the late form of 6 (ↅ, similar to the Greek stigma: Ϛ), the early form of 50 (ↆ, similar to to the downward-pointing arrow ↓⫝⊥ ), 50,000, and 100,000. It should be noted that the backsmall small c, ↄ is not included in Roman numeral characters, but is included in the Unicode standard as the Claudian capital Ↄ.

Roman numerals to Unicode
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 these characters. In everyday life, ordinary letters of the Latin alphabet are used. Displaying these characters requires software that supports the Unicode standard and a font that contains the glyphs corresponding to these characters.

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 thrown out by the trader 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).

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 thrown out by the trader 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).

Spasskaya Tower chiming clock with Roman numerals on the dial Numeral systems in culture Indo-ArabEast AsianAlphabeticalOther Positional Mixed systems Non-positional
Arabic
Tamil
Burmese
Khmer
Laotian
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
KPPU symbols
2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 60
Nega-positional
Symmetrical
Fibonacci
Unit (unary)

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

Natural numbers are written by repeating these numbers. Moreover, if a larger number is in front of a smaller one, then they are added (the principle of addition), but if a 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 repeating the same number four times.

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

Roman numerals

Number Designation
1 I
2 II
3 III
4 IV, until the 19th century - III
5 V
6 VI
7 VII
8 VIII (sometimes - IIX)
9 IX (sometimes VIII)
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ƆƆIƆƆƆ
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 typesetting due to technical complexity). For other authors, the overbar could indicate an increase in the value of the figure by 1000 times: V = 5000.

Tissot watch with the traditional “IIII” spelling

It was only in the 19th century that the number “four” was written down as “IV”; before that, the number “IIII” was most often used. However, the entry “IV” can already be found 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 "VIII" numerals on the opposite side, and an inverted "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 two digits closest in the number series to the subtrahend (that is, the subtrahend multiplied by 5 or 10) can be used as a minuend. Repetitions of a smaller number are not allowed. Thus there is only six options using the “subtraction rule”:

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

For example, the number 94 would be XCIV = 100 − 10 + 5 − 1 = 94 - the so-called “subtraction rule” (appeared in 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 unacceptable; thus, the number 99 should be written as XCIX, but not as IC. However, nowadays, in some cases, a simplified notation of Roman numerals 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 a digit, any other digit can be written to the left of it:

Cases of such recording 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 indicating the day of the week on a shop window in Vilnius
  • Monarch serial number
  • Corps number in the Armed Forces
  • Blood type on the uniform patches of the Russian Armed Forces
  • Base of homeopathic dilutions (Conium X3, Aconitum 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 in many archival documents of those times. Similarly, using a slash, they also wrote down the date of the lesson in class journals, for example: 24/II. To indicate dates of life and death on tombstones, a special format was often used, where the month of the year was also indicated in 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 application of Roman numerals may have specific features. In Western countries, the year number 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, Roman numerals can be used to indicate the days of the week on road signs, store windows, and business signs.

Unicode

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

Number Forms(English) Number Forms) in the area of ​​characters with codes U+2160 to U+2188. For example, MCMLXXXVIII can be represented in the form ⅯⅭⅯⅬⅩⅩⅩⅧ. This range includes both lowercase and uppercase digits for writing the numbers 1 (Ⅰ or I) to 12 (Ⅻ or XII), including combination glyphs for composite 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. Combination glyphs are used to represent numbers that were previously composed of individual characters (for example, Ⅻ instead of its representation as Ⅹ and Ⅱ). In addition to this, glyphs exist for the archaic forms of 1000, 5000, 10,000, major reverse C (Ɔ), the late form of 6 (ↅ, similar to the Greek stigma: Ϛ), the early form of 50 (ↆ, similar to to the downward-pointing arrow ↓⫝⊥), 50,000, and 100,000. It should be noted that the backsmall small c, ↄ is not included in Roman numeral characters, but is included in the Unicode standard as the Claudian capital Ↄ.

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 1 000 U+2160 U+2170 Value 1 000 5 000 10 000 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 glyphs corresponding to these characters (for example, 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) to find Roman numerals in a string ?X(0,3)|X)?(?:I(0,3)?V?I(0,3)|I)))\b/gs.

Conversion

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

Conversion functions in JavaScript 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; 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+1 end; Rim2Arab:= N end; begin WriteLn("Translation from Arabic to Roman numerals. 1999 B_SA"); ( Write("Enter the number to convert:"); ReadLn(N);) for NI:= 26 to 46 do WriteLn(NI," = ",Arab2Rim(NI)," reverse ", Rim2Arab(Arab2Rim(NI)) ); end. Function for converting an Arabic number to a Roman number 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;

Function for converting an Arabic number to a Roman number in BASIC (the shortest code) 10 INPUT "ARABIC NUMBER: "; А$ 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 Arabic number conversion function (in this case 1999) in 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]), "") 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 to convert Arabic number (from 1 to 3999) to 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 into Arabic and back, on CSharp /// /// The class is designed for converting Arabic numbers into Roman numbers and back /// /// /// The class initially contains an alphabet of Roman numbers that can determine Arabic numbers numbers from 1 to 39999 /// If you need to expand the range, you can define additional notations for Roman numbers using /// the BasicRomanNumbers field public static class RomanNumber ( /// /// Alphabet of basic Roman numbers /// The alphabet is built in the form The dictionary key is the Arabic number (int), the value is the 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...ↂ) Since in the Roman numeral one character cannot /// appear more than three times, then initially you can 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 should add additional notations 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"); BasicRomanNumbers.Add(9, "IX"); BasicRomanNumbers.Add(10, "X"); BasicRomanNumbers.Add(40, "XL"); BasicRomanNumbers.Add(50, "L"); "); Basic Roman Numerals.Add(90, "XC"); Basic Roman Numerals.Add(100, "C"); Basic Roman Numerals.Add(400, "CD"); Basic Roman Numerals.Add(500, "D"); Basic Roman Numerals.Add (900, "CM"); BasicRomanNumbers.Add(1000, "M"); BasicRomanNumbers.Add(4000, "Mↁ"); BasicRomanNumbers.Add(5000, "ↁ"); BasicRomanNumbers.Add(9000, "Mↂ" ); BasicRomanNumbers.Add(10000, "ↂ" ) /// /// Calculates the maximum possible Roman number for the current Roman number alphabet. /// /// Maximum possible Roman numeral public static uint MaximumRomanNumber() ( int lastNumber = BasicRomanNumbers. Keys.Last(); int numberWithoutZeros = int.Parse(lastNumber.ToString().Replace("0","\0")); int preliminary=0; switch (numberWithoutZeros) ( case 1: preliminary = lastNumber * 4 - 1; break; case 4: case 9: preliminary = lastNumber; break; case 5: preliminary = lastNumber + lastNumber / 5 * 3; break; default: break; ) return uint.Parse(preliminary.ToString().Replace("0", "9"));; ) /// /// Converts an integer into a Roman numeral /// /// An Arabic number that needs to be converted to Roman notation /// Generated when a number equal to "0" /// or a number greater than the maximum is passed as a parameter Roman numeral. /// 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 (числоАраб >MaximumRomanNumber()) throw new ArgumentOutOfRangeException("numberArab", numberArab, string.Format("Invalid argument value: it is not possible to specify a Roman numeral greater than (0)", MaximumRomanNumber())); //We decompose the Arabic number into its constituent Roman numbers and combine them into one line var necessary Basic Roman Numbers = from to in Basic Roman Numbers. Keys where to = 1) ( Arab number -= current; Roman number. Append (Basic Roman Numbers [current]); ) ) return Roman number .ToString(); ) /// /// Converts a Roman numeral to an Arabic numeral /// /// A Roman numeral to be converted to an int /// Generated when a non-Roman number is passed as a parameter /// An integer representing an Arabic notation Roman number public static int Roman Arabic(this string Roman number) ( int Arab number = 0; sbyte negative = 1; string Rome = Roman number.Trim(); if (Roman == "-") ( negative = -1; Roman = Roman. Substring(1); ) StringBuilder RomanNumber template = new StringBuilder(); foreach (int to in BasicRomanNumbers.Keys) ( int index = BasicRomanNumbers.Keys.IndexOf(k); string quantifier="?"; if (index == 0 | | (index % 4) == 0) quantifier="(0,3)"; templateRomanNumber.Insert(0, string.Format("(?((1))(2))?", to.ToString() , BasicRomanNumbers[k], quantifier) ​​) //Ignore case + match must start at the beginning of the string RomanNumber template.Insert(0, "(?i)^"); //Match must be found at the end of the string RomanNumber template.Append(" $"); //Simplified check. Does not check for errors like IVII if (!Regex.IsMatch(Roman, RomanNumber pattern.ToString())) throw new FormatException(string.Format("Text \"(0)\" is not a Roman numeral", numberRoman)); Match number = Regex.Match(Roman, templateRomanNumber.ToString()); foreach (int to in BasicRomanNumbers.Keys) ( numberArab += number.Groups[to.ToString()].Length / BasicRomanNumbers[to].Length * to; ) return numberArab * negative; ) )

Roman numerals are:

Roman numerals Spasskaya Tower chiming clock Numeral systems in culture Indo-Arabic number systemEast Asian number systemsAlphabetic number systemsOther systems Positional number systems Mixed number systems Non-positional number systems
Arabic
Indian
Tamil
Burmese
Khmer
Laotian
Mongolian
Thai
Chinese
Japanese
Suzhou
Korean
Vietnamese
Counting sticks
Abjadia
Armenian
Aryabhata
Cyrillic
Greek
Ethiopian
Jewish
Katapayadi
Babylonian
Egyptian
Etruscan
Roman
Attic
Kipu
Mayskaya
Decimal number system (10)
2, 3, 4, 5, 6, 7, 8, 9, 12, 16, 20, 60
Nega-positional number system
Symmetrical 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 numbers. Moreover, if a larger number is in front of a smaller one, then they are added (the principle of addition), but if a smaller number 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 repeating the same number four times.

Roman numerals appeared 500 BC among the Etruscans.

Numbers

Roman numerals

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

M s D arim WITH face-to-face L imons, X vatit V seven I X.

M s D we eat C tips L look X ok V well-mannered I to individuals

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

Examples

Number Roman notation Note

To correctly write large numbers in Roman numerals, you must first write 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 early periods, there were signs to indicate larger numbers - 5000, 10,000, 50,000 and 100,000[ source not specified 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 appear 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 figure representing a hundred is repeated twice, and the figures 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 down together: MCMLXXXVIII.

Quite often, to highlight numbers in the text, a line was drawn over them: LXIV. Sometimes a 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 typesetting due to technical complexity). For other authors, the overbar could indicate an increase in the value of the figure by 1000 times: VM = 6000.

Tissot watch with the traditional “IIII” spelling

It was only in the 19th century that the number “four” was written down as “IV”; before that, the number “IIII” was most often used. However, the entry “IV” can already be found 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 "VIII" numerals on the opposite side, and an inverted "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 number are not allowed. In Roman, the number 94 would be XCIV=100-10+5-1=94 - the so-called “subtraction rule” (appeared in 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 acceptable; thus, the number 99 should be written as XCIX, but not as IC. However, nowadays, in some cases, a simplified notation of Roman numerals 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 a digit, any other digit can be written to the left of it:

  • 999. Thousand (M), subtract 1 (I), we 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), get 950 (LM). Consequence: 1950 - MLM instead of MCML

Large numbers can also be written using Roman numerals. To do this, a line is placed over those numbers that denote thousands, and a double line is placed over the numbers that denote millions. For example, the number 123123 would look like this:

And a million is like I, but with not one, but 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.
  • Serial number of the monarch: Charles V, Catherine II.
  • The volume number in a multi-volume book (sometimes the numbers of parts of the book, sections or chapters).
  • In some publications - the numbers of sheets with the preface to the book, so as not to correct the links within the main text when the preface is changed.
  • Antique-style markings on watch dials.
  • 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 serial number of the 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 application of Roman numerals may have specific features; for example, in Western countries, the year number is sometimes written in Roman numerals.

If we break down 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. until 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 Number Forms(English) Number Forms) in the area of ​​characters with codes U+2160 to U+2188. For example, MCMLXXXVIII can be represented in the form ⅯⅭⅯⅬⅩⅩⅩⅧ. This range includes both lowercase and uppercase numerals from 1 (Ⅰ or I) to 12 (Ⅻ or XII), including combination glyphs for composite numbers such as 8 (Ⅷ or VIII), primarily for compatibility with East Asian character sets in industry standards such as JIS X 0213 where these characters are defined. Combination glyphs are used to represent numbers that were previously composed of individual characters (for example, Ⅻ instead of its representation as Ⅹ and Ⅱ). In addition to this, glyphs exist for the archaic forms of 1000, 5000, 10,000, major reverse C (Ɔ), the late form of 6 (ↅ, similar to the Greek stigma: Ϛ), the early form of 50 (ↆ, similar to to the downward-pointing arrow Template:Vmvauyairufktr5ke4fuiUnicode), 50,000, and 100,000. It should be noted that the small back-c, ↄ is not included in Roman numeral symbols, but is included in the Unicode standard as the uppercase Claudian letter Ↄ.

Roman Numerals in Unicode 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 1 000 U+2160 U+2170 Value 1 000 5 000 10 000 - - 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 containing the glyphs corresponding to these characters.

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) to find Roman numerals in a string )(I|V?I(0,3)))/g".

Conversion

To convert numbers written in Arabic numerals into Roman numerals, 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).

Conversion functions in JavaScript 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; 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+1 end; Rim2Arab:= N end; begin WriteLn("Translation from Arabic to Roman numerals. 1999 B_SA"); ( Write("Enter the number to convert:"); ReadLn(N);) for NI:= 26 to 46 do WriteLn(NI," = ",Arab2Rim(NI)," reverse ", Rim2Arab(Arab2Rim(NI)) ); end. Function for converting an Arabic number to a Roman number 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, you consider a string to be an array of characters).

Function for converting an Arabic number to a Roman number in BASIC (the shortest code) 10 INPUT "ARABIC NUMBER: "; А$ 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 Arabic number conversion function (in this case 1999) in 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]), "") 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 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 back, on CSharp /// /// The class is designed to convert Arabic numbers to Roman numbers and back /// /// /// The class is originally contains an alphabet of Roman numbers capable of defining Arabic numbers from 1 to 39999 /// If you need to expand the range, you can define additional notations for Roman numbers using /// the BasicRomanNumbers field public static class RomanNumber ( /// /// Basic Roman Alphabet numbers /// The alphabet is built in the form of a dictionary. The key of the dictionary is the Arabic number (int), the value is the 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...ↂ) Since in the Roman numeral one character cannot / // occur more than three times, then initially you can convert numbers from 1 to 39999 to Roman format. /// If you want to be able to work with a large number of Roman numbers, then you should add additional notations to the list /// starting from 40000 not 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"); BasicRomanNumbers.Add(9, "IX"); BasicRomanNumbers.Add(10, "X"); BasicRomanNumbers.Add(40, "XL"); BasicRomanNumbers.Add(50, "L"); "); Basic Roman Numerals.Add(90, "XC"); Basic Roman Numerals.Add(100, "C"); Basic Roman Numerals.Add(400, "CD"); Basic Roman Numerals.Add(500, "D"); Basic Roman Numerals.Add (900, "CM"); BasicRomanNumbers.Add(1000, "M"); BasicRomanNumbers.Add(4000, "Mↁ"); BasicRomanNumbers.Add(5000, "ↁ"); BasicRomanNumbers.Add(9000, "Mↂ" ); BasicRomanNumbers.Add(10000, "ↂ" ) /// /// Calculates the maximum possible Roman number for the current Roman number alphabet. /// /// Maximum possible Roman number public static uint MaximumRomanNumber() ( int lastNumber = BasicRomanNumbers.Keys.Last(); int numberWithoutZeros = int.Parse(lastNumber.ToString().Replace("0","\0 ")); int preliminary=0; switch (numberWithoutZeros) ( case 1: preliminary = lastNumber * 4 - 1; break; case 4: case 9: preliminary = lastNumber; break; case 5: preliminary = lastNumber + lastNumber / 5 * 3; break; default: break; ) return uint.Parse(preliminary.ToString().Replace("0", "9"));; /// /// Converts an integer to a Roman number /// / // Arabic number that needs 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 (числоАраб >MaximumRomanNumber()) throw new ArgumentOutOfRangeException("numberArab", numberArab, string.Format("Invalid argument value: it is not possible to specify a Roman numeral greater than (0)", MaximumRomanNumber())); //We decompose the Arabic number into its constituent Roman numbers and combine them into one line var necessary Basic Roman Numbers = from to in Basic Roman Numbers. Keys where to = 1) ( Arab number -= current; Roman number. Append (Basic Roman Numbers [current]); ) ) return Roman number .ToString(); ) /// /// Converts a Roman numeral to an Arabic numeral /// /// A Roman numeral to be converted to an int /// Generated when a non-Roman number is passed as a parameter /// An integer representing an Arabic notation Roman number public static int Roman Arabic(this string Roman number) ( int Arab number = 0; sbyte negative = 1; string Rome = Roman number.Trim(); if (Roman == "-") ( negative = -1; Roman = Roman. Substring(1); ) StringBuilder RomanNumber template = new StringBuilder(); foreach (int to in BasicRomanNumbers.Keys) ( int index = BasicRomanNumbers.Keys.IndexOf(k); string quantifier="?"; if (index == 0 | | (index % 4) == 0) quantifier="(0,3)"; templateRomanNumber.Insert(0, string.Format("(?((1))(2))?", to.ToString() , BasicRomanNumbers[k], quantifier) ​​) //Ignore case + match must start at the beginning of the string RomanNumber template.Insert(0, "(?i)^"); //Match must be found at the end of the string RomanNumber template.Append(" $"); //Simplified check. Does not check for errors like IVII if (!Regex.IsMatch(Roman, RomanNumber pattern.ToString())) throw new FormatException(string.Format("Text \"(0)\" is not a Roman numeral", numberRoman)); Match number = Regex.Match(Roman, templateRomanNumber.ToString()); foreach (int to in BasicRomanNumbers.Keys) ( numberArab += number.Groups[to.ToString()].Length / BasicRomanNumbers[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 page 95, V. Ptitsyn, Moscow
  6. Author - Kuznetsov Evgeny A.
  7. Author - Kuznetsov Evgeny A., 1992

see also

  • Symbols of ancient Roman monetary and weight units
Technical Note: Due to technical limitations, some browsers may not display the special characters used in this article. These characters may appear as boxes, question marks, or other nonsense characters depending on your web browser, operating system, and fonts installed. Even if your browser is capable of interpreting UTF-8 and you have installed a font that supports a wide range of Unicode, e.g. 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 in this area often differ. 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 compelling reasons for replacing it with a more convenient decimal system of numbers 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 was common in Europe for two thousand years. Only in the late Middle Ages was it replaced by a more convenient decimal system of numbers, borrowed from the Arabs. But, to this day, Roman numerals are used to indicate 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 use Roman numerals to denote ordinal numbers.
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. A horizontal line above the symbol meant multiplication by a thousand.
Natural numbers are written by repeating these numbers. Moreover, if a larger number is in front of a smaller one, then they are added (the principle of addition), but if a smaller number 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 repeating the same number four times. For example, I, X, C are placed respectively before X, C, M to indicate 9, 90, 900 or before V, L, D to indicate 4, 40, 400. For example, VI = 5+1 = 6, IV = 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 Roman numeral system is not currently used, with the exception, in some cases, of designating centuries (XV century, etc.), 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.
http://ladyretryka.ru/?p=10980

What number does the Roman numeral M represent?

What number does the Roman numeral M represent?

Alsou - sh

I have already answered a similar question (see here). I would like to briefly answer this question as well.

I'll repeat myself a bit.

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

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

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



Now let’s write it ourselves:

This year's number 2015 , for example, would be written like this: MMXV

1941 - MSMXXXXI

1945 - MSMXXXXV

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 hundred.

General rules: You cannot put more than one smaller number in front of a larger number to subtract. So, IIV does not mean 3.

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

Natasha

We are used to using Arabic numerals. But Roman ones still exist and are widely used, which are 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 arrangement denotes a number. If these numbers are located separately from the rest, they have the following meanings: I - 1, V - 5, X - 10, L - 50, C - 100, D - 500, M - 1000.

Beautiful glade

The Roman numeral M (also a letter) means the 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 represent numbers and they can be used to 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 “huge thousand”, “thousand”, and it’s interesting how this word appeared, but that’s another story ..

Afanasy44

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

The Romans used the letter M to denote a thousand. Two letters MM next to each other mean two thousand, MMM three thousand, and then it’s even more difficult and more 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 a thousand. and this Roman numeral originates from the Latin word mille.

Lyudmila 1986

The ancient Romans used 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), marking dials, in mathematical analysis, and important events.


Bee Zhuzha

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

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


We recommend reading

Top