convert/roman
convert positive integers to Roman numerals
Calling Sequence
Parameters
Description
Examples
convert(n, roman, opts)
n
-
positive integer
opts
(optional) equation(s) of the form option=value where option is one of large, period, or symbol; specify options for the conversion
The convert(n, roman) function converts the positive integer n to the Roman numeral represented as a string.
The following table gives the Roman letters representing various integers.
Letter
Value
I
1
V
5
X
10
L
50
C
100
D
500
M
1000
Give a value N where N is a power of 10. To write the value for either 2⁢N, 3⁢N, or 4⁢N, repeat the Roman numeral for N either 2, 3, or 4 times. For example, 2, 30, 400 can be represented by II, XXX and CCCC, respectively.
Give a value N where N is a power of 10. To write the value for either 6⁢N, 7⁢N, 8⁢N, or 9⁢N, write the Roman numeral for 5⁢N followed by the Roman numeral for N either 1, 2, 3, or 4 times. For example, 6, 70, 900 are represented by VI, LXX, and DCCCC, respectively.
There is a modification to writing Roman numerals for numbers that are a power of 10 multiplied by 4 or 9. The Roman numeral for 4⁢N or 9⁢N is written as N followed by the Roman numeral for 5⁢N or 10⁢N, respectively. For example, 4, 9, 40, and 900 can be represented by IV, IX, XL, and CM, respectively. This modification was introduced near the end of the Republic.
All other numbers are created by taking these multiples and placing them together with the largest value on the left and smallest value on the right. For example, 1527 is the sum of 1000, 500, 20, and 7, which are represented by M, D, XX, and VII, forming MDXXVII.
Originally, the Roman numerals for 500 and 1000 were represented as I9 and CI9 where the 9 is used in place of a backwards C, or apostrophus. Further multiples of 10 were denoted by adding an extra apostrophus for multiples of 500 and surrounding CI9 by another C and 9 pair. The following table gives these values up to one million:
Historic Roman Number
I9
CI9
5000
I99
10 000
CCI99
50 000
I999
100 000
CCCI999
Values greater than 100⁢000 have not been observed historically.
Over time, the I9 was simplified to D and the CI9 was replaced by an M. With this new format, the logarithmic method of denoting larger numbers was lost. To denote values like 12000, it was necessary to use MMMMMMMMMMMM.
To solve this problem, drawing a horizontal line (or vinculum, titulus) over V, X, L, and C indicates a multiple of 1000 of these numbers. Thus, 97607 would be written as:
___
XCVMMDCVII
There is no historical evidence that a further multiple of 1000 could be indicated by a second line.
The values 500⁢000 and 1⁢000⁢000 were represented by Q (from quingenta milia) and a box around the letter X (for decies centena milia, or 10 hundred thousand), respectively. There is no historical evidence that a C surrounded by a box is intended to represent 10⁢000⁢000.
Other unsupported formats are:
Using a C instead of an apostrophus, for example, IC and CIC for 500 and 1000, respectively.
Using an infinity or a capital Phi symbol for 1000.
Writing multiples of 1000 by prefixing an M by the multiple, for example, 7000 would be VII M.
Using subtractive notation while using apostrophi, but this would require spacing to avoid confusion, for example, C I9 is 400 but CI9 is 1000.
Using double subtraction, for example, IIX and CCM instead of VIII and DCCC to represent 8 and 800, respectively.
You can modify the properties of the conversion by including options opts. The opts argument can contain one or more of the following equations.
period = early, middle, or late
In early times, all values were displayed using the additive format. In the transition, it was still common to use the additive format for values 4 and 9 but the subtractive format for larger values. In the late period, almost all numbers were written using the subtractive format exclusively. Clock faces (using IIII for 4 is one exception.)
large = apostrophus or repeated
By default, large numbers are created by repeating an M sufficiently many times. If this option is set to apostrophus, the older version using CI9 to represent 1000 is used. For ease of reading, values greater than 100 are separated by spaces.
symbol = truefalse
The default output is a string. If the option symbol is set to true, then the result is a symbol.
convert⁡2849,roman
MMDCCCXLIX
convert⁡2849,roman,period=early,symbol
MMDCCCXXXXVIIII
convert⁡35034,roman,large=apostrophus
CCI99 CCI99 CCI99 I99 XXXIV
plotslistplot⁡seq⁡length⁡convert⁡i,roman,large=apostrophus,i=1..2400
See Also
convert
convert,arabic
Download Help Document