# 16/09/2004 @18:32:54 ^20:55:40

## HOW TIMES CHANGE

**8:30am, 16th September 2003:** Having not slept at all the previous night, tired and scared out of my wits, I prepared to start a new job that would eventually degenerate into just about the most boring time of my life.

**8:30am, 16th September 2004:** Having similarly not slept all night, this time I don't care. Some more of my Doom map is done and for once I don't feel like it is rubbish. Now I can go to sleep in comfort as the morning sunshine filters through the pores in the curtains.

### Problem solving, teamwork, and building on the achievements of others

I am forever getting caught up in the solving of problems or the answering of questions for which the outcome and/or success of solving doesn't matter to me. For example yesterday I spent about 2 hours reading linux networking manual pages and the source code of libpcap/tcpdump, knowing full well I wouldn't care if I found out why things in the code I was looking at were going wrong...but I had to try to find out.

Similarly today I went to here and I was sure I could work out what the first 10 digit prime in the decimal expansion of *e* was, even though the place I'd come from, slashdot, had already posted that all it was all in aid of was an extremely convoluted job advert for Google Labs. In fact that made it easier not to care.

The reason it would be easy is that on most every unix system ever there is bc:

`echo 'scale=`**N**;e(1)' | bc -l

and you can replace **N** with anything and get as many digits as you like, except it'll take quite a long time if you make it too big of course. I used 1000 which took about a second to calculate on this 1.6GHz duron. Then it is a matter of splitting the resulting string of numbers into blocks of 10 and testing each for primality.

`echo 'scale=1000;e(1)' | bc -l | tr -d '.\\ ' | xargs | tr -d ' ' | \`

perl -ne 'for ($i=0;$i+10<length($_);$i++) { print substr($_,$i,10),"\n"; }' | \

xargs factor | awk 'NF==2 {print $2}'

You remove all the extraneous characters such as decimal points, escaped linebreaks and so forth, then concantenate all the lines onto one using xargs. Remove the spaces, then there's a little perl script that prints out consecutive sets of 10 digits. That bit could probably be severely optimised but who cares?

Anyway then you use xargs again to run each 10 digit string into a program called *factor* (part of a package called *shellutils* in Debian). This produces output of the form

`2718281828: 2 2 97 179 39139`

i.e. the number, then a list of its prime factors. We want the numbers that only have one prime factor listed. Hence *awk 'NF==2 {print $2}'*; *NF* is the number of words (fields, separated by whitespace) on the line. Equivalently I could have said *$1==$2 {print $2}* for the awk script because if a number has only one prime factor that factor must be the number itself (although thinking about it the colon on the end of $1 could complicate matters)

Anyway, so all you do is read off the first one that comes out and put into your web browser 7427466391.com and feel pleased with yourself.

Until you read the second puzzle! Here's where I came unstuck. The natural thing to assume is that you're looking for some kind of sequence, since it's phrased *f(1) = ..., f(2) = ...* and so forth, each ellipsis being a string of 10 digits from the decimal expansion of *e.*

So I started off looking at the line numbers of the output from my expansion split into blocks of 10. f(1) was line 2, f(2) 6, f(3) 24 and f(4) - the first 10 digit prime - was line 100. There's a weird coincidence for you, if you take the decimal expansion of *e* remove the decimal point and start counting from 1 the first 10 digit prime starts at position 100. Of course 2, 6, 24 immediately made me think of factorials but 100 doesn't fit. I toyed around with quadratics, cubics, exponentials, didn't get any further.

So I gave up. I thought *I bet someone's already solved this and splurged the answer all over the internet in an attempt to whore for attention* (IRONY ALERT) I turned the problem against its creator by googling for 7427466391. First hit was 7427466391.com itself but the second was some guy's weblog about google (yeah seems it's fashionable to blog about google, which is why I'm doing it, I'm such a whore) which leads on to this discussion the third post on which gives the game away. I'd never have thought to try adding up the digits in each 10 digit set pattern. So I adapted my command:

`echo 'scale=1000;e(1)' | bc -l | tr -d '.\\ ' | xargs | tr -d ' ' | \`

perl -ne 'for ($i=0;$i+10<length($_);$i++) { print substr($_,$i,10),"\n"; }' | \

perl -lne '$a=0; for (split//) { $a+=$_;}; print "$a $_";' | grep ^49

which I realise could be really optimised, but I still don't care. Anyway it does another little bit of perl to print the sum of the digits in each 10 digit set before set, then we just grep out the one whose digits add up to 49. The first four give f(1),...,f(4) on 7427466391.com so the next one must be f(5).

So following the trail leads to Google Labjobs which we knew already. This is a fairly condescendingly written job advert, which talks about separating the wheat from the chaff and all sorts of nonsense (except they phrase it for stupid geeks by saying things like "signal to noise ratio") Thus I encourage you to send as many stupid joke CVs ("resumés") to the address on the page. Let's write a covering letter!

Dear Google Labjobs,

I found your site after trawling the series of puzzles you set up for me. I managed to solve the first one by brute forcing it but the second one had me stumped until I used your excellent search facility to find the solution which I was sure The Internet had already ascertained.

I think this shows not only my capacity for problem solving but my propensity for teamwork and building on the achievements of others, which are as much a part of success in the modern world as pure cognitive ability.

I hope you will consider this application.

Yours sincerely,

Rob Young,

Currently Unemployed Lazy Shite And Not Caring About It,

England.

Wankers.