Here’s a bit of old code for writing Roman Numerals:

Gist https://gist.github.com/miner/9ff494e7cd0c9af64d03