Here is the code that I used to find my message in pi:
$pi = "314159265358979323..."; $base = -65; $offset = 0; while ($offset < (100 - (ord('_')-65))) { print "Offset $offset "; $find = "JUST_ANOTHER_PI_HACKER"; $index = 0; while ($find ne "") { $fnum = sprintf("%2.2d",ord(substr($find,0,1))+$base+$offset); substr($find,0,1) = ""; $found = index($pi, $fnum, $index+2); print "FAILED" if $found < 0; $found -= $index; $index += $found; print "$found "; } print "\n"; ++$offset; }
You will have to find yourself a suitable source of pi digits, I recommend either the algorithm that I borrowed, or Project Gutenberg (zip). Figure on 100 digits per letter, then sum the offsets produced to find out how many digits are actually used.

I chose to limit it to upper case letters and underscores as spaces, but that can be fixed. It scans a range of offsets so you can choose the shortest list of positions, then calculate the offset to recreate the original message. In the instance provided, it just happens that an offset of 1 results in +64 in the recreation code, which is actually rather disappointing because it looks like I didn't make the effort to optimise the offset list! If I had done "JUST_ANOTHER_PERL_HACKER" that would have resulted in offset 29, giving +36 instead of +64 in the final code, and I could have asked "For bonus ++, why is the +36 value there?"


In reply to Finding messages in pi by PhilHibbs
in thread Slow JAPH by PhilHibbs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.