http://qs321.pair.com?node_id=1009126


in reply to Dueling Flamingos: The Story of the Fonality Christmas Golf Challenge

I've managed to reduce the Hospelian Arabic to Roman Transform by one byte.

As a lead-in, I've read most of your nodes at some point (always good reading, btw), and when I first saw Ton's amazing formula, I spent a few moments dissecting it to figure out how it did what it did. Recently, while working on a similar problem, I decided to see if I could reproduce his formula, armed with the knowledge of how it worked.

A few hours of brute forcing later, and I had a result. Naturally, I wanted to check back here to see how I had done. I was pleasantly surprised to find that I had stumbled upon a formula that was one byte shorter!

Ton's original formula:
y/CLXVI6240-9/MDCLXXVI/dfor$$_.=5x$&*8%29628

The one byte improvement:
y/CLXVI60-9/MDCLXVIX/dfor$$_.="32e$&"%72726

Alternative:
y/CLXVI0-9/MDCLXIXV/dfor$$_.="57e$&"%474976

Even though "32e$&"%72726 is one byte longer than Ton's 5x$&*8%29628, it saves 2 bytes in the transliteration, because 01 is transliterated with IX. The alternative transliterates 012 with IXV, saving yet another byte, but it uses a modulus that's one digit longer.

Update:
Since originally posting, I've found several more alternatives of the same length, using multiple substitutions for I and/or V:

y/CLXVI0-9/MDCLXIVXI/dfor$$_.="49e$&"%87971 y/CLXVI0-9/MDCLXIIXIV/dfor$$_.="7e$&"%10606 # y/CLXVI0-9/MDCLXIIXIV/dfor$$_.="7e$&"%15909 # y/CLXVI0-9/MDCLXIIXIV/dfor$$_.="7e$&"%31818 # These are all essential +ly the same y/CLXVI0-9/MDCLXIIX V/dfor$$_.="8e$&"%61535 # Doesn't contain 3 anywh +ere # although this is one byte longer, it saved a byte in the challenge I + was working on y/CLXVI60-9/MDCLXXI V/dfor$$_.="37e$&"%97366 # Doesn't contain 1 anywh +ere