```Jeff Schwab wrote:
> Joel VanderWerf wrote:
>> Daniel Moore wrote:
>>> This week's quiz is to write a Ruby program that can compute the first
>>> 100,000 digits of ?.
>>
>> Bonus points for determining the first non-trivial ruby program
>> encoded in that sequence of digits.
>
> Interesting idea!
>
> Is there any way of determining whether a given sequence of bytes is a
> valid ruby program, other than running it?  If this were my paternus
> lingua, C++, I would start by chucking each candidate sequence at a
> compiler.
>
>> (Represent a program source string as a sequence of octal triplets
>> that is, or is not, a subsequence of the octal representation of ?.)
>
> What is an "octal triplet?"  Do you mean that the integer value of each
> byte in the source code should be represented by a sequence of three
> octal digits (e.g. 077 for ?? and 141 for ?a)?
>
> I'm curious:  Why octal?  It seems an odd choice, given that an "octal
> triplet" corresponds to 9 bits, rather than the 8 in a standard byte.
> Why not "hex pairs?"

You're right, that didn't make much sense. I was just thinking of "\nnn"
and counting to three, but of course that's 9 bits. What I was trying
to do was slice off just enough bits to make a printable char with high
probability. Otherwise, the 128..255 will keep breaking up otherwise
legal program strings.

Base 128 (7 bits) would be better, but there are still some non-printing
chars. Even better would be to skip ascii and use something else, but I
didn't want to get too far into fantasy land...

> Btw, isn't every finite sequence of digits a subsequence of Pi's
> representation in that base?  Or is that unknowable?

IIRC that's true. But the _first_ ruby program... gee, that's got to
mean something. :)

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

```