The Printing Of Pi
HomeHome > Blog > The Printing Of Pi

The Printing Of Pi

Aug 08, 2023

It really isn't necessary, but there is some geek cred to learning pi to some bizarre number of digits. One way to do that is via a piem — a mnemonic device that is easy to remember and gives you the digits. Don't know any? [Roni Bandini] has you covered with the PiemPi machine. It prints a random piem on a thermal printer and calculates each digit on the fly. You can watch the machine in action in the video below.

Unfortunately, the Raspberry Pi Zero inside doesn't have enough language skills to ensure the thing makes sense, so you get word salad that may or may not have any real meaning. For example, [Roni] quotes astronomer [Sir James Jeans’] phrase: "How I want a drink, alcoholic, of course, after the heavy lectures involving quantum mechanics." Before the advent of calculators, we always used: "May I have a large container of coffee today?" In each case, you count the number of letters in each word to get the digits. However, some of the piems you can see from the machine start off with phrases like: "# leon a yahoo execution im actual total pit eagle detector christmas…"

Since the machine can generate many digits, there is a problem that starts at digit 33. There are several zeros in the number. In this case, the printer prints a blank line. We might not have used symbols in the output, but since the phrases don't really make sense anyway, it probably doesn't matter much. Of course, there's also little point in computing the digits for each print. You could compute them once, store them, and never have to do it again. Pi doesn't change value. However, as a fun project, it doesn't matter, and it does illustrate how a computer can find pi. In this case, the system uses the Chudnovsky algorithm.

If you don't want to wait for the little Raspberry Pi, the 10, trillionth digit of pi is, by all accounts, 5. The problem with printing this is you need a lot of paper if you want to get up into the trillions. But you could use a Mobius printer (although full disclosure: that device grabs digits from the pi-as-a-service server; try curl "https://api.pi.delivery/v1/pi?start=0&numberOfDigits=100").