Skip to content

converts normal intergs to ROMAN numerals written to showcase javaScript skills

License

Notifications You must be signed in to change notification settings

abhi00o7/roman-numeral-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

roman-numeral-converter

range: '1 >>> 3999999'

converts normal intergs to ROMAN numerals written to showcase javaScript skills

  • The rules of roman numerals:
  • ==============================
  • There are six basic rules when it comes to roman numerals.
  • Rule 1: The numerals:

  • All roman numerals are written using a combination of base numerals and subtractive numerals.
  • There are only seven base numerals which can be used to create any numeral sequence or number representation:
  • Utilizing the base numerals, there are also six subtractive numerals which act as shortcuts to represent numerals which would otherwise require four or five individual numerals:
  • I, V, X, L, C, D, M
  • Rule 2: The calculation:

  • The value of a roman numeral sequence is calculated by simply adding together the numerals, from left to right.
  • For example, the number 1988 converted to roman numerals is MCMLXXXVIII which is calculated from left-to-right as:
  •              M+CM+L+X+X+X+V+I+I+I
    
  • Rule 3: Number limits:

  • Any sequence of standard roman numerals can only represent numbers from 1 to 3999.
  • There is no zero in roman numerals.
  • Using bracket notation or vinculum notation we can write roman numerals from 4000 to 3999999.
  • Rule 4: Sequencing:

  • Roman numerals are written from left to right, and from highest to lowest (in terms of individual numeral value).
  • A higher value numeral cannot appear after a lower value numeral (unless in the context of an individual subtractive numeral).
  • Rule 5: Repetition:

  • An individual numeral cannot appear more than three times consecutively in any sequence.
  • If you find yourself with four same-value numerals consecutively, it can always be simplified by using a subtractive numeral in its place.
  • A special case for this simplification rule is four M's. This exceeds the 3999 limit and would be invalid unless vinculum notation
  • or bracket notation were adopted. Using bracket notation, four M's becomes (IV).
  • Rule 6: Single use numerals:

  • There are individual numerals which can only appear once in any sequence.
  • All subtractive numerals can only appear once in any sequence.
  • From the set of base numerals: V, L, and D should only appear once.
  • The only caveat to this is when using another notation such as bracket notation.
  • A single-use numeral can appear once within the brackets and once outside the brackets.
  • For example, 5005 in bracket notation is (V)V.

About

converts normal intergs to ROMAN numerals written to showcase javaScript skills

Resources

License

Stars

Watchers

Forks

Packages

No packages published