Skip to main content
2 of 5
added 32 characters in body
Value Ink
  • 12.6k
  • 1
  • 17
  • 42

#Ruby, 137 134 bytes

Preliminary solution, recursive function that returns the string. I'm trying to golf down the numeral encodings a bit more if possible, but I"m not sure how.

f=->x{s=(x<t=1e3)?"":"(#{f[x/t]})";x%=t
"CM900D500CD400C100XC90L50XL40X10IX9V5IV4I1".gsub(/(\D+)(\d+)/){v=$2.to_i;s+=$1*(x/v);x%=v};s}
Value Ink
  • 12.6k
  • 1
  • 17
  • 42