HomeBlogAbout UsWorkContentContact Us

National Pi Day

A couple of weeks ago, it was 3/14, National PI day. (See the non-binding resolution of the US House of Representatives HRES 224)

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!

If you can think of something to search for in Pi, Google it, and Iíll wager that somebody has probably already done it.

5 Trillion digits

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?

*5 Trillion, thatís 5x1012 or 5,000,000,000,000

If you printed out these digits in 10pt Courier font, double sided, on 8.5Ēx11Ē paper with economical 0.5Ē margins on 75 gsm paper (that's 20lb paper for you non-metric people), the resultant stack of paper would be 85,733 feet tall (thatís over 16 miles tall – more than twice as high as you cruise in a Boeing 737).

A picture of Pi

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.

Pi as a picture

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.


You can find a complete list of all the articles here.      Click here to receive email alerts on new articles.

© 2009-2013 DataGenetics    Privacy Policy