There was an interesting post on Reddit for generating a visual representation of the first 100,000 digits of \(\pi\). I modified the code slightly use Brilliant's color palette, and made a variation for producing \(\tau.\) I ran this code on Ubuntu Linux, but it should work on any Unixbased platform (Linux, OS X, BSD, etc), though you will have to figure out how to install dependencies yourself.
This works by generating 100,000 digits, converting them to color pixels in a 2step process, and then generating a final image. Here's the result:
If you'd like to do it yourself, you will need basic commandline tools available on Unix, as well as:
 the ImageMagick toolsuite for generating the final image
the
pi
utility for generating \(\pi\) quickly; you could use \(\text{arctan}(1)\times4\) as the original code does, but it is so slow that it never finished running on my machine and I gave up after ~30 mins.On Ubuntu, install dependencies like this:
1 

Here's the original code, modified to use Brilliant colors and for faster execution:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 

Details on how it works:
 Generate the digits of \(\pi\) by using the
pi
utility  Trim off everything other than digits from the output
 Convert the digits to letters
 Replace the letters with RGB color codes that match the Brilliant palette
 Add a header for the Netpbm graphics format that specifies the dimensions and color properties
 And finally use the ImageMagick
convert
utility to produce a PNG imagepi100k.png
To produce \(\tau\), modify the code slightly to multiply \(\pi\) by 2 using the unix utility bc
:
1 2 3 4 

Pretty big difference between the two, no? =P
Can you figure out how to generate 1,000,000 digits of \(\pi\) or \(\tau\) as a 1000x1000 pixel square image?
Comments
Sort by:
Top NewestThe 3rd digit of PI seems to be wrong in image. Could someone check? – Marcelo KortKamp · 4 months, 2 weeks ago
Log in to reply
how can I get long digits of pi in matlab? – Ibrahim Hameed · 5 months ago
Log in to reply
Hi Anton,
I actually made a site a few months ago that builds the first 500,000 digits of pi pixel by pixel.
https://simpleti.me/pi.html
This picture might be based off of it. – Matt Formica · 5 months, 1 week ago
Log in to reply
I just found a way to get the value of pi: https://brilliant.org/discussions/thread/ifoundthevalueforpionmyown – Akshat Joshi · 5 months, 3 weeks ago
Log in to reply