I created this wonderful reflective picture, something that Scott Kim would be proud of, and intended to use it as part of my Pi Day blog posting. I then downloaded the first billion digits of Pi and fully intended to do lots of juicy and whimsical data-mining on those digits. The problem is, I couldnít come up with a unique idea!
Find your birthday in Pi page — Done (many times)
Find your social security number in Pi Page — Done (ditto)
Frequency analysis of the of the digits, couplets, n-grams in Pi — Done, Done, Done
If you can think of something to search for in Pi, Google it, and Iíll wager that somebody has probably already done it.
Pi has been calculated to so many digits (over 5 Trillion at the time Iím writing this)*, that if you search hard enough you and pretty much find anything you want in there.
Conspiracy fanatics can stop reading now, Iím not going to excite you by showing how you can find details of all the past natural disasters buried in the digits (you can), or birth dates of all the US Presidents. If this disappoints you, might I suggest an evening enjoying a cocktail with Pink Floyd and The Wizard of Oz, or reading The Bible Code?
What Iím going to do for my (belated) tribute to Pi day is to draw pictures of Pi, and search these pictures for a graphical representation of Pi inside of itself. Hey, why not?
First of all, we want a target of what weíre looking for. Here it is. Itís a (7x5) bitmap of the symbol for Pi (the 16th letter in the Greek alphabet). I purposely selected this bitmap to have white-space all around the edges so that it would be easy to see.
Next we need to covert Pi into a bitmap. Using a simple translation on the decimal representation of Pi , I converted the digits to pixels with the key that the digits 0-4 are shaded white, and the digits 5-9 black. This produced a random strip of shaded pixels.
To convert this into a canvas, I stacked these strips into rows with 23 columns of digits per row to make a tall bitmap. Here are the first few rows of this bitmap. (If you look at the first row, you should be able to recognize the strip image above).
A couple of regular expression searches later, at position 345,385,381 weíve found what weíre looking for. Look closely – we've found Pi inside Pi.
Is this amazing? No not really. When you have a billion random pixels, itís pretty easy to find whatever you want! I could just as easily have searched for Pacman logos, or checkerboards instead of a Pi bitmap.
And why did I make the rows 23 characters wide (instead of 40, or 75)? No reason, and thatís just the point. I could have, just as easily, made the rows 31 columns wide, and then Pi appears at position 250,634,381 (see below).
You can find a pattern in anything if you stare at it long enough.
Check out other interesting blogarticles.