Having an interest for numbers, Linux and small scale programming and scripting shortens the route to test out things like this. It generally starts out with: “I wonder what that would look like” and ends in a continuous awe for numbers, programming and Linux. Having seen similar attempts to visualize numbers and an earlier attempt to look for snowball numbers, I wanted to see how the never-ending and never-repeating stream of decimals of Pi would look like.

I would have to decide some basic rules, but let those rules be repeated for all digits. For each of the decimals, I chose to draw a tiny square, then move in one direction the same length as one side of the square TIMES the decimal digit. Then I would turn 90 degrees counter-clockwise TIMES the decimal digit. Of course, this could have been completely different, but I would have to settle on something. This would do, I thought to myself. I also chose ten distinct hexadecimal colors and let each digit 0-9 have its own color, just to make the result colorful.

I wanted to test this on Pi, but why stop there. I could compare the never-ending decimals of Pi with Tau or Eulers constant e as well. What would they look like compared to each other?

### CALCULATING 100.000 DECIMALS OF PI, TAU AND E

First, I had to find the long trail of decimals and I know I could have gone online and found already calculated decimals, probably a lot of the too, but where is the fun in that? I set out to do the calculations myself. For that task I chose the command line calculator bc, which did this very nicely. I did take some time for 100.000 decimals, about a day and a half on an old 64bit computer running Ubuntu.

$ BC_LINE_LENGTH=0 bc -l <<< "scale=100000; 4*a(1)" >> pi100k.txt

This worked fine for Pi and Tau, but e not so much. It ran for a few days and I had to give up. I’m not sure what method bc uses for solving e(1), but I had to resolve to the precalculated list mentioned above. I used the linux command head -c100002 to grab the first 100k decimal from a 160 million text file that site served.

Once I had a text file with all the decimals for each irrational constant, I used Python and a drawing library called turtle for the job. I might have used something else, but I already knew turtle.

The script I wrote for the job takes the text file containing all the decimals as input and saves the result as a postscript file in the same directory or folder. I struggled a little bit with getting the result nicely placed in the center of the .eps file, so I fiddled a wee bit with the start position for the turtle. You can see in the script that I chose different starting positions for the various input files, not automated. This can be improved, but I was focusing on the resulting art instead.

### THE SCRIPT

So, you can see the results below. I tried with 10.000 decimals and then 100.000 which gave a nicer structure. I could also go for a million decimals, but this would take a lot of time on my computer. I might give it a go later. Another challenge for later would be so see how the base 10 numbering system is compared to the hexadecimal or other number bases.