Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: The 10**21 Problem (Part I)

by Grimy (Pilgrim)
on May 30, 2014 at 08:05 UTC ( #1087950=note: print w/replies, xml ) Need Help??

in reply to The 10**21 Problem (Part I)

You can easily gain one character on the Perl one:
sub u {IXCMVLD=~$_;"1E@-"%9995} sub i {XCMVLD=~$_;"1E@+"%9995} print $_, v9, u, v9, i, $/ for qw(M D C L X V I);
M 1000 1000 D 500 500 C 100 100 L 50 50 X 10 10 V 5 5 I 1 1

Replies are listed 'Best First'.
Re^2: The 10**21 Problem (Part I)
by eyepopslikeamosquito (Archbishop) on May 30, 2014 at 23:49 UTC

    Thanks Grimy.

    By the way, the PHP md5 solution works in Perl too since these two languages have essentially the same bitwise string operators:

    use Digest::MD5 qw(md5_hex); sub r {uppp&md5_hex$_.PQcUv} print "$_: ", 0+r(), "\n" for (qw(I V X L C D M));

    I've updated the Perl summary of shortest solutions in the root node like so:

    VLD=~$_*5+IXCM=~$_."E@-" # Perl 10**(7&5045e8/ord)%2857 # Perl (64-bit) IXCMVLD=~$_;"1E@-"%9995 # Perl XCMVLD=~$_;"1E@+"%9995 # Perl (Grimy improvement) uppp&md5_hex$_.PQcUv # Perl (needs Digest::MD5 module)

    As you can see, if Perl had a md5 built-in function, this would be the shortest Perl solution -- even with a ridiculously long md5_hex function name!

    Update: for full details on how I happened to find this md5 solution, see Re^2: The golf course looks great, my swing feels good, I like my chances (Part III).

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1087950]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2023-10-04 20:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found