The Walk of Pi: In 736036 Days Digits Around the World

Happy $pi$ day everyone! But it is not just an ordinary $pi$ day, no, it is the ultimate $pi$ day!

3/14/15 9:26:53
To celebrate this awesome day, i decided to write an entry devoted to the beauty of $pi$. Specifically, about the random walk of $pi$.


Random Walk with $pi$

Artacho and colleagues wrote a very nice paper about “Walking on Real Numbers”  [1]. What they did was quite simple. They converted the digits of $pi$ and other mathematical constants into the base-4 numeral system and used this representations to perform a random walk in the following way: For each 0 go one step left, for each 1 go one step up, for each 2 go one step right and for each 3 go one step down. The results are very nice visualitations (I gave it a try above with 1M digits) which show the apparent randomness in the digits of $pi$ et al.

The Journey of Pi

The work of Artacho and colleagues is truly beautiful, but of course it is a bit too scientific for this blog. Thats why, we are now sending $pi$ on an adventure to explore the world. Imagine the following scenario:

On the first of January in the year 0,  a heavy burden was placed on little boy Pi. He got the task to spread the word about the beauty of $pi$ in as many countries as possible until 3/14/2015 (exactly 736036 days). Each day he could walk/swim exactly 50km in one of the cardinal directions, where the direction was given by the days digit of pi in base 4. That is  if the digit is a 0 or 2 he travels 50km east or west. If it is a 1 or 3 he travels 50 km north or south. He starts his journey on (0,0). Which countries will he visit?

I guess this scenario sounds mildly scientific enough to analyse. So which countries does little Pi visit in his 2015 year long journey? And which countries would have never learned about the beauty of $pi$? The following map provides the answer (red dot was the starting point)


Pi actually missed quite a few countries.  From a total of 244 countries/territories/colonies, Pi did not visit 111. Even my home country Germany! It is interesting to see, how he “avoided” a big part of Europe and also some African Countries which are not that far from his point of departure.

Due to his weird traveling route, Pi did not only miss some countries but also visit several points more than once. The following map shows, how often he visited certain locations. The darker the color, the more often he was there.

The most frequently visited point by Pi was -100 Longitude and 43.5 Latitude: The Middle of Nowhere, South Dakota, USA. And he went there 57 times… It also becomes apparent, why he missed so many countries. He was sailing around quite a lot on the seven seas. So at the end, was Pi just a Pirate?


Yes, i admit this scenario is a bit whacky. But mathematically still quite interesting. For example the world consisted of 259200 reachable locations in my example. A random walk with 736036 steps could have visited each location almost 3 times! There is a lot more interesting stuff behind this scenario, which I will talk about in later posts.

This post was also quite interesting from a visualizational point of view. I guess without the help of the R package rworldmap and this stackoverflow thread, this post wouldn’t have been possible.

Leave a Reply

Your email address will not be published. Required fields are marked *