WOLFRAM CHALLENGES
​

Maximum Roman Numeral Length

THE CHALLENGE
​
Write a function that finds the maximum length of any Roman numeral up to n.

More Details

The first five Roman numerals are I, II, III, IV, V, and so the maximum length of any Roman numeral up to
n=5
is 3.

What Your Function Should Do

Write a function MaxRomanLength that takes a positive integer n as an input and outputs the maximum length of any Roman numeral up to n. Use
RomanNumeral
to generate the numerals.
In[1] :=
MaxRomanLength[8]
Out[1] =
4
In[2] :=
MaxRomanLength[100]
Out[2] =
8
In[3] :=
MaxRomanLength[1000]
Out[3] =
12

More Examples

SCRATCH AREA
​
​
ENTER YOUR CODE HERE
​
In[]:=
MaxRomanLength[n_Integer?Positive]:=Max[StringLength/@RomanNumeral[Range[n]]]
Submit
Note:
Sign into the Wolfram Cloud
to save your work on
Challenges and keep track of progress.