Questions tagged [roman-numerals]

The Roman numeral system is an ancient way of representing numbers. The base symbols are I (1), V (5), X (10), L (50), C (100), D (500) and M (1000).

Roman numerals on Wikipedia

273 questions
190
votes
16 answers

How do you match only valid roman numerals with a regular expression?

Thinking about my other problem, i decided I can't even create a regular expression that will match roman numerals (let alone a context-free grammar that will generate them) The problem is matching only valid roman numerals. Eg, 990 is NOT "XM",…
Daniel Magliola
  • 30,898
  • 61
  • 164
  • 243
131
votes
17 answers

How can you customize the numbers in an ordered list?

How can I left-align the numbers in an ordered list? 1. an item // skip some items for brevity 9. another item 10. notice the 1 is under the 9, and the item contents also line up Change the character after the number in an ordered list? 1) an…
grom
  • 15,842
  • 19
  • 64
  • 67
94
votes
94 answers

Convert a number into a Roman numeral in JavaScript

How can I convert integers into roman numerals? function romanNumeralGenerator (int) { } For example, see the following sample inputs and outputs: 1 = "I" 5 = "V" 10 = "X" 20 = "XX" 3999 = "MMMCMXCIX" Caveat: Only support numbers between 1 and…
DD77
  • 1,367
  • 2
  • 13
  • 25
75
votes
29 answers

Converting Integers to Roman Numerals - Java

This is a homework assignment I am having trouble with. I need to make an integer to Roman Numeral converter using a method. Later, I must then use the program to write out 1 to 3999 in Roman numerals, so hardcoding is out. My code below is very…
user1752197
  • 781
  • 1
  • 6
  • 4
66
votes
32 answers

Converting integers to roman numerals

I'm trying to write a function that converts numbers to roman numerals. This is my code so far; however, it only works with numbers that are less than 400. Is there a quick and easy way to do this conversion, or extend my existing code so that it…
Kavithova L
  • 661
  • 1
  • 5
  • 3
37
votes
9 answers

Numbers to Roman Numbers with php

I need to transform ordinary numbers to Roman numerals with php and I have this code: 'I', "number" => 1), array("letter" => 'V', "number" => 5), …
LukasMakey
  • 373
  • 1
  • 3
  • 5
31
votes
10 answers

How to sort an array of Roman numerals?

I have an array containing Roman numerals (as strings of course). Like this: $a = array('XIX', 'LII', 'V', 'MCCXCIV', 'III', 'XIII'); I'd like to sort them according to the numeric values of these numerals, so the results should be something…
kapa
  • 77,694
  • 21
  • 158
  • 175
30
votes
14 answers

How to convert a Roman numeral to integer in PHP?

Using PHP, I'd like to convert a string containing a Roman number into its integer representation. I need this because I need to make calculations on them. Wikipedia on Roman numerals It would suffice to only recognize the basic Roman numeral…
kapa
  • 77,694
  • 21
  • 158
  • 175
30
votes
3 answers

Convert roman numerals to numbers in R

In R, there is a great function as.roman in the very base setup: as.roman(79) # [1] LXXIX Is there an inverse function that would convert roman numerals to numbers? (I know I can write it myself but I prefer to use already prepared or preferably…
Tomas
  • 57,621
  • 49
  • 238
  • 373
22
votes
3 answers

How to convert integer value to Roman numeral string?

How can I convert an integer to its String representation in Roman numerals in C ?
Vishwanath Dalvi
  • 35,388
  • 41
  • 123
  • 155
21
votes
4 answers

How do you find a roman numeral equivalent of an integer

How do you find a roman numeral equivalent of an integer. Is there a java library which provides this capability? I did find a similar question, but I would prefer an out of the box API abstraction for this issue. Its just painful to handle all…
Jason
  • 12,229
  • 20
  • 51
  • 66
17
votes
31 answers

Code Golf New Year Edition - Integer to Roman Numeral

Write a program that take a single command line argument N and prints out the corresponding Roman Numeral. Eg N = 2009 should print MMIX. Let's say this should work for 0 < N < 3000. (Had fun playing my first ever round of code golf with the…
user4812
  • 5,942
  • 9
  • 30
  • 35
15
votes
24 answers

Roman numerals to integers

In data sometimes the same product will be named with a roman numeral while other times it will be a digit. Example Samsung Galaxy SII verses Samsung Galaxy S2 How can the II be converted to the value 2?
Dennis Puzak
  • 3,726
  • 3
  • 23
  • 22
10
votes
1 answer

Need to change section to Roman, but keep Arabic for for subsection and subsubsection

I need to change my section numbering from Arabic, to Roman, beet keep the Arabic numbering in subsections and subsubsections. For example: I. Section 1.1. Subsection 1.1.1. Subsubsection II. Section 2.1 Subsection ... So I know that with sections i…
Hiro Protagonist
  • 103
  • 1
  • 1
  • 4
10
votes
2 answers

How can I make a roman numeral list in Markdown?

How do I create a roman numeral list in Markdown? Like this... i) Higher per acre field of sugarcane. ii) Higher sucrose content of sugarcane. iii) Lower Labor cost. iv) Longer crushing period.
besrabasant
  • 2,422
  • 6
  • 27
  • 41
1
2 3
18 19