Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

The 10**21 Problem (Part I)

by eyepopslikeamosquito (Chancellor)
on Apr 21, 2014 at 17:01 UTC ( #1083046=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub r {
        my %h = ( I=>1, V=>5, X=>10, L=>50, C=>100, D=>500, M=>1000 );
        return $h{$_};
    }
    print "$_: ", 0+r(), "\n" for (qw(I V X L C D M));
    
  2. or download this
    I: 1
    V: 5
    ...
    C: 100
    D: 500
    M: 1000
    
  3. or download this
    sub r {%h=(I,1,V,5,X,10,L,50,C,100,D,500,M,1000);$h{$_}}
    sub r {M1000D500C100L50X10V5I1=~$_;$'}
    sub r {M999D499C99L49X9V4I=~$_+$'}
    
  4. or download this
    sub r {5**y/VLD//.E.(3*/M/+2*/C|D/+/X|L/)}
    sub r {1 .E.~-ord()*41%52%5>>y/VLD//}
    ...
    sub r {1 .E.(72^ord)*5/7%5>>y/VLD//}
    sub r {5**y/VLD//.E.(42^88*ord)%5}
    sub r {1 .E.(3^77%ord)%7>>y/VLD//}
    
  5. or download this
    sub r {10**(7&69303333/ord)%9995}
    sub r {10**(7&5045e8/ord)%2857}     # needs 64-bit Perl
    sub r {IXCMVLD=~$_;"1E@-"%9995}
    sub r {XCMVLD=~$_;"1E@+"%9995}      # Grimy improvement
    
  6. or download this
    10**(205558%ord(r)%7)%9995  # Python
    hash(r+"magicstrng")%1001   # Python (finding magicstrng is the subjec
    +t of this node!)
    ...
    10**(494254%r/9)%4999       # Ruby (no need for explicit ord in this g
    +ame)
    md5($r.magicstrng)          # PHP (finding magicstrng is an unsolved p
    +roblem)
    md5($r.PQcUv)&uppp          # PHP wins due to superb mf properties of 
    +md5
    
  7. or download this
    import time
    print time.time(), time.clock()
    ...
              if i != 1: continue
              print "bingo!", q0, q1, q2, q3, q4, q5, q6, q7, q8, q9
    print time.time(), time.clock()
    
  8. or download this
    #include <stdio.h>
    #include <time.h>
    ...
          (double) (cend-cstart) / (double)CLOCKS_PER_SEC);
       return 0;
    }
    
  9. or download this
    #include <stdio.h>
    #include <string.h>
    ...
       do_one(sv0, sv1, ev1, sv2, ev2, sv3, ev3);
       return 0;
    }
    
  10. or download this
    #define H_PRIME   1000003
    #define HASH_LEN  11
    ...
      }
      return iret;
    }
    
  11. or download this
    m3 = (m2 ^ q3) * H_PRIME;
    d3 = (d2 ^ q3) * H_PRIME;
    ...
    x3 = (x2 ^ q3) * H_PRIME;
    v3 = (v2 ^ q3) * H_PRIME;
    i3 = (i2 ^ q3) * H_PRIME;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1083046]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2019-12-07 01:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (160 votes). Check out past polls.

    Notices?