Update November 2016: I recently tried to remake this more rigorously, and discovered I made at least one incorrect assumption in the details below (i.e. I’m pretty sure I got the carryover rules wrong). I’m not going to rewrite this, but just know that it’s not necessarily right – and, in what should have been my very first step anyway, the brute-force version is fast enough for this scale of numbers anyway and much easier to trust.
If you ignore less-common variations of particular digits (such as writing 4 as IIII instead of IV), there’s only one way to write any individual number* as a Roman numeral. And despite usually needing more than one ‘character’ per digit, unlike our current Arabic numeral system, it’s still base 10 and each magnitude of 10 is similarly self-contained. For example, 1776:
1776 = 1000 + 700 + 70 + 6
MDCCLXXVI = M + DCC + LXX + VI
Recently I was wondering about Roman numerals. There’s only one way to write any individual number, so the question of “what is the longest Roman numeral?” is trivial, and usually contains a lot of 8s (88 is the longest under 100, 888 is the longest under 1000, 3888 is the longest under 5000, and so on). But there’s an easy way to introduce variation, which is the question I ended up looking at:
For a given number A, what are the two numbers B and C such that A = B + C, and the number of characters in B and C when expressed in Roman numerals is greatest?
What’s the longest way to write a number as the sum of two Roman numerals? Continue reading Making unnecessarily long sums with Roman numerals