# Pi Day Composition Redux

It’s a bit of an on-again-off-again tradition on Pi Day (3-14 in the United States) to share my composition based on the digits of Pi.

It was based on the binary digits rather than decimal digits of Pi, which seemed more universal and also more logical to work with. It uses stretched impulses and square waves for the sounds themselves. At least that is what I recall. It was written in 2011. It’s probably time to revisit the concept with a new piece…

# Pi Digits Revisted

For Pi Day, we revisit my composition based on the digits of Pi from 2011. Enjoy!

Note that this is based on binary digits, not the familiar 3.14159… in decimal notation. But the number itself is the same regardless of the base one uses to represent it.

# Pi Day, 2011 (with Music) Every year, we at CatSynth join numerous other mathematics enthusiasts, geeks and otherwise eccentric characters in celebrating Pi Day on March 14.

March 14 is notated in the U.S. and some other countries as “3-14”, which evokes the opening digits of π (pi). Although the date representation is a very arbitrary connection to the number, we also recognize that the representation of π in decimal digits is arbitrary, an accident of human beings having ten fingers. So this year we are exploring the representations in binary and other related bases.

To represent an integer in binary, one of course presents it as a sum of powers of two, e.g., 11 = 8 + 2 + 1 or 1011 in binary. But one can also represent fractional numbers in binary. Digits to the right of the decimal point represents powers of one-half. So the binary number 0.11 is 1/2 + 1/4, or 3/4. Fractions like 1/3 can be represented with repeating digits as 0.010101…, much like in base ten. And this concept can be extended to irrational numbers like π.

The author of this website has calculated 32768 digits of pi in binary. We reprint the first 258 below:

```11.
00100100 00111111 01101010 10001000 10000101 10100011 00001000 11010011
00010011 00011001 10001010 00101110 00000011 01110000 01110011 01000100
10100100 00001001 00111000 00100010 00101001 10011111 00110001 11010000
00001000 00101110 11111010 10011000 11101100 01001110 01101100 10001001
```

The initial “11” represents the 3 in π, and the remaining digits begin the non-integral portion. Like in the decimal representation, the binary representation continues forever with no particular pattern. While not as iconic or memorable as the decimal representation 3.14159…, there is something about the binary representation that makes it seem more universal, i.e., based on fundamental mathematical truths rather than a quirk of human anatomy. For me, the binary representation also lends itself to musical ideas. And for the occasion, I have created a couple of short synthesized pieces representing the 32768 binary digits of pi. In the first example, each binary digit represents a sample. The “1” represents full amplitude and the zero represents no amplitude (silence). The result, which at 44.1kHz sample rate is less than one second long, can be heard below.

The random configuration of digits sounds like noise, and more specifically like white noise, suggesting something approaching uniform randomness at least to human hearing. I also made an example slowed down to a level whether the individual samples became musical events. I find this one quite interesting.

With some additional refinement (and may some more digits to extend the length), it could certainly stand alone as a composition.

One interesting counterpoint to the notion that digits of pi form white noise is a conjecture related to its representation in hexadecimal (base 16), which as a power of two is “closer” to binary and seemingly less arbitrary than decimal. From Wolfram MathWorld, we find the following “remarkable recursive formula conjectured to give the nth hexadecimal digit of π – 3 is given by where is the floor function: The formula is attributed to (Borwein and Bailey 2003, Ch. 4; Bailey et al. 2007, pp. 22-23). If true, it would add some sense of order to the digits, and thus additional musical possibilities.

# Pi Day

We at CatSynth once again join others in recognizing Pi Day today.  This time, Google is joining in as well with one of the special “Google Doodles” on their front page: The image very nicely captures many of the well-known geometric and trigonometric properties of &pi; in an abstract representation of the Google logo.

Of course, I tend to me be more curious about some of the more esoteric properties that interrelate to other parts of mathematics.  For example, consider  seemingly unrelated Gaussian Integral. This is the area underneath the Gaussian function which is usually associated with normal distributions probability and statistics. The interrelation of π and e, which we have presented in previous years, is at play again here. The approximation of the square root of π is 1.77245385…, and like π itself, is a transcendental number. In addition to its appearance in the Gaussian Integral and the Gamma Function (which we also presented on a past Pi Day), it plays an important part of the ancient mathematical problem of Squaring the Circle, that is constructing a square with the same area as a circle using only a compass and a straight edge. Because the square root of π is transcendental, it suggests that Squaring the Circle is in fact impossible. But that probably won’t stop some people from continuing to try.

# Pi Day 3.14159…

We at CatSynth once again, celebrate Pi Day on its three-digit approximation, March 14 (3-14).

We start with some interesting facts about the digits of pi. We presented statistics about the distribution in our 2007 Pi Day post. From super-computing.org, we present some interesting patterns:

01234567890 first occurs at the 53,217,681,704-th digit of pi.
09876543210 first occurs at the 42,321,758,803-th digit of pi.
777777777777 first occurs at the 368,299,898,266-th digit of pi.
666666666666 first occurs at the 1,221,587,715,177-th digit of pi.
271828182845 first occurs at the 1,016,065,419,627-th of digit pi. (that’s e for those who haven’t memorized it)
314159265358 first occurs at the 1,142,905,318,634-th digit of pi.

Last year, we showed the relationship to the Gamma function, and of course to Euler’s identity, which links pi surprisingly closely to the imaginary constant i and the number e. But it is also surprisingly easy to generate pi from simple sequences of integers. Consider the Madhava-Leibniz formula for pi: Thus one can generate pi from odd integers and simple arithmetic. Another formula only involving perfect squares of integers comes from the Basel problem (named for the town of Basel in Switzerland): In recognition of Pi Day, the U.S. House of Representatives passed a resolution this week:

And thus the sad history of pi in politics as exemplified by the Indiana Pi Bill of 1897 is put to rest. Now onto erasing the sad history of science and politics in general of the past eight years…

# Prime-counting function revisited

A couple of weeks ago we posted an article on “Calculus for Cats” and the Prime Number Theorem, which featured the, the prime-counting function π(x):

Basically, this function counts the number of primes less than or equal to a particular number. For example π(20) would be all the prime numbers less than 20: 2, 3, 5, 7, 11, 13, 17 and 19. So π(20) = 8.

So to calculate π(1000) would one have to literally count all the prime numbers less than 1000, including figuring out which numbers are prime? And what about π(1000000)? Unfortunately, the answer is yes.

Unfortunately, the answer is no, as Victor points out in the comments. Or more specifically, Victor's cat Blue Chip says “Neow!” I think is the point where one is supposed to say “my bad.” Victor is in fact V. S. Miller who co-authored the paper “Computing pi(x): The Meissel-Lehmer Method”.

The oldest method for computing π(x) is to use the sieve of Eratosthenes, which is literally counting all the primes below x. More efficient methods have existed for quite a while, notably astronomer E. D. F. Meissel found a method in the 1870s that he used to compute π(100,000,000) as 5,761,455; and π(1,000,000,000), though his result was found to be slightly off (too small by 56). It should be noted that Meissel carried out his calculations without the aid of a digital computer. D.H. Lemher extended and simplified Meissel's method in the context of modern computers, and calculated π(1010).

Miller and his co-authors present new algorithms that refine the Meissel-Lehmer method, including new sieving techniques and optimizations for parallel computing. Those interested in the technique are encouraged to read the paper. The “Extended Meiseel-Lehmer” technique is used to compute π(1016) as 279,238,341,033,925.

They also include an interesting chart comparing large values of π(x) and Li (x), the offset logarithmic integral that we presented in our article. Recall that Li(x) is an upper bound on the value of π(x). And for 1016, the difference between Li(x) and π(x) is 3,214,632. Only off by three million, which isn't too bad…

This post was included in Carnival of Mathematics #33 at Walking Randomly.

# Fun with Pi (Day) We saw this picture on meeyauw, and thought it was a good way to open our own Pi Day offering. Pi Day, or π day is celebrated on March 14 (3/14) of every year.

π does turn up in some interesting places besides circles and standard trigonometry (and LOLcat photos). There is of course Euler's famous identity: which unites π with four of the other most famous constants in mathematics: zero, 1, i (the imaginary root of -1) and e. But it also turns up in some more surprising places. Consider the well-known factorial function, where n! or “n factorial” is the product of all the integers between 1 and n. For example:

### 5! = 5×4×3×2×1 = 120.

Simple enough. But of course some troublemaker is eventually going to ask for the factorial of 1/2. Not so easy. Fortunately, there is a function, called the Gamma function, that provides a solution: Not really as simple as the original integer-only factorial. Once calculus is involved, might as well forget about it. But if you go through the trouble of plugging in 1/2 to the formula, you get the following intriguing result: or So the factorial of one half is one half the square root of π. Who knew?

# Fun with stats: digits in Pi

From Eve Andersson's Pi land, we have these histograms of the frequency of (base 10) digits.

The first 100 digits of pi:

 0 8 1 8 2 12 3 12 4 10 5 8 6 9 7 8 8 12 9 13

Things even out pretty nicely by about 1 million digits:

 0 99959 1 99757 2 100026 3 100230 4 100230 5 100359 6 99548 7 99800 8 99985 9 100106

The digits are just white noise, there might be an interesting pattern now and then, but that is to be expected statistically. Besides, these are base 10 digits, which are an arbitrary representation based on the fact that we have two hands with five fingers apiece…

I could share some more interesting facts and formulae, but printing the greek character pi on a blog is, as they say, a pain in the butt. And I am not in the mood for that tonight.