2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,10 +1,5 @@
|
|||
RomanForm[i_Integer?Positive] :=
|
||||
Module[{num = i, string = "", value, letters, digits},
|
||||
digits = {{1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"}, {100,
|
||||
"C"}, {90, "XC"}, {50, "L"}, {40, "XL"}, {10, "X"}, {9,
|
||||
"IX"}, {5, "V"}, {4, "IV"}, {1, "I"}};
|
||||
While[num > 0, {value, letters} =
|
||||
Which @@ Flatten[{num >= #[[1]], ##} & /@ digits, 1];
|
||||
num -= value;
|
||||
string = string <> letters;];
|
||||
string]
|
||||
RomanNumeral[4]
|
||||
RomanNumeral[99]
|
||||
RomanNumeral[1337]
|
||||
RomanNumeral[1666]
|
||||
RomanNumeral[6889]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue