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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.