So, Google currently has a little promotion that involves a sort of puzzle hunt. The first puzzle, published on billboards and at
googleblogatom is to find the first 10-digit prime number to occur in consecutive digits of e.
I tried to solve it using only standard unix programs, with the following pipeline:
cat e.2mil | delay_line 10 | factor | awk '$1=$2":" {print($2)}'
That pops out the right answer immediately...
e.2mil is a text file containing the first 2 million digits of e, and delay_line is a little C program that takes a stream of characters and whenever it receives a character after the ninth character, it outputs the previous ten characters seen. It would be much more satisfying if delay_line were implemented as a clever script and perhaps if e.2mil were generated somehow instead of with Mathematica or a Google search. (I know that there are faster ways to check primality than explicitly computing factors, but obviously this is quick enough...)
Two fun exercises on the side: download GNU coreutils and look at the sourcecode to factor
to see how it works (it uses 'Wheel Factorization'), and compute the expected position of the first 10-digit prime in a random sequence of digits.
The second puzzle is to find what comes next in this sequence: 7182818284, 8182845904, 8747135266, 7427466391, _____ .
Further notes will appear on
nibot_lab.