Tuesday, 23 November 2010

The PiSBN Project

I don't normally apologise for being a bit of a geek.  There's a part of my brain that's into computers and space and science and all that, it's just the way things are.

But to be honest, even I cringe a little at my latest little project.  Sorry about this.

Pi is an interesting number.  It goes on forever, doesn't repeat itself, and appears to be entirely random.  And in an infinite, random sequence, you get every possible combination of numbers eventually.  Your phone number is in there somewhere.  And every book written, if you convert the numbers into ASCII.

Searching Pi for books like that would be stupid though, you'll burn up the best computers on the planet before you get anything worthwhile.  There is, however, a quicker alternative.

Almost every single book published since 1966 has an ISBN number.  These days they all start 978, then there's another ten digits.  The last one's a check digit made by multiplying the others up in a certain way.

So I wrote a program that searches Pi for ISBN numbers.  Then it checks them to see if the check digit is a valid one.  Then it looks the ISBN up on Google Books.

I got three hits in the first fifty million digits of Pi.  It took about ten minutes.  Actually, it took about three hours to write the thing properly, another hour debugging it, and a frustrated lie in the bath half way through.  And about six cups of tea.  Once it actually worked it was fairly quick though.

And so, ladies and gentlemen, I present for you edification and entertainment, the first three books in Pi.  (Cue fireworks.)

At the four hundred and nine thousand, seven hundred and eighty third decimal place, we have:

Licentiate seminar on environmental engineering and biotechnology
by the Tampereen teknillinen korkeakoulu. Bio- ja ympäristötekniikka.
(Tampere University of Technology. Department of Biological and Environmental Engineering.) 

I have to admit that I haven't read this one, but I'm quite chuffed that the first book (well, journal) is something a bit geeky.

In second place, at the two million, one hundred and twenty thousand, two hundred and fourth place, is:

Sneeuwwitje en Rozerood
by Jacob Grimm

Or as it's known in English, Snow White and Rose Red.  And because the original is not covered by copyright you can get a copy from the excellent Project Gutenberg.  Not hugely geeky, but there is something wonderfully gothic and conspiratorial about one of Grimm's turning up.

And taking the bronze, at the three million, six hundred and thirty thousand and thirty third decimal place:

The healing knife
by George Sava

A curious sounding book written under a nom de plume by a "noted Harley Street Surgeon".

I'll bet you feel better now that you know what the first three ISBN numbers are in Pi?  I know I certainly do.

Sorry again.

No comments:

Post a Comment