## Do copies of Hamlet exist embedded in the digits of pi?

I know Vi Hart discussed it, but she may have not been the first to entertain the idea. Not sure. The question is do they digits of pi contain copies of hamlet?

Yes, yes they do. Not just copies of Hamlet, but actually copies of every book imaginable are contained within the digits of pi an infinite number of times.

Using software package pi and simple shell commands,

pastebin of shell commands

I found that any N digit sequence probably appears within the first 10^N digits of pi [1]; moreover, the sequence would appear about 10 times in the first 10^(N+1) digits of pi, 100 times in the first 10^(N+2) digits, etc.

For example, lets say our sequence is the last 4 digits of my phone number – 1345
That’s 4 digits, so if I scan the first 104 digits of pi, sure enough, my phone number occurs 1 time. If I scan 105 digits, it occurs 12 times. For 109 digits, it occures like 98 times. Its clockwork. See below.

altoidnerd@HADRON:~\$ pi 10000|grep -o 1345|grep -c 1345
1
altoidnerd@HADRON:~\$ pi 100000|grep -o 1345|grep -c 1345
12
altoidnerd@HADRON:~\$ pi 1000000|grep -o 1345|grep -c 1345
114
altoidnerd@HADRON:~\$ pi 10000000|grep -o 1345|grep -c 1345
1020

Anyway, so the question is how many digits of pi would we need to search through to likely find about 1 or 2 copies of hamlet in the sequence?

So I got hamlet in plaintext from 2 sources. I found that hamlet when compressed from plain text to a tar.gz archive, the average size was 69 KiB. Therefore, (I think?) that means to represent hamlet as just a binary integer, it would have 69 x 8 x 1024 digits = 565248 digits.

To get the number of digits in base 10, we multiply by log_10 (2) +~ .69 so the base ten hamlet would be like a sequence of about ~390,000 digitsm (0-9).

Ok so back to pi. How many digits of pi must we scan to probably find a string of length 390,000? That would be 10^390000 digits. That’s a lot of pi, but pi has got enough digits to spare. We should see approximately 1 copy of hamlet in the first 10^390000 digits of pi.

Even cooler is that if we just increase the power by 1, we should see 10 hamlets; increase the power by 2, and we should get 100 copies of hamlet. So quickly, we end up with infinite hamlets in the digits of pi. And not only hamlet … this argument should would for any book.

[1] This is not too surprising since pi is believed to be a normal number, though this is unproven.

## Understanding the magnetic dipole moment

If you want to understand more about the parameter μ, try this.

We know (or at least accept) the usual equation E = – μ • B and perhaps one or two expressions for μ, like I*A or maybe even one using the current density J

μ = 1/2 ∫ d3x (r x J)

But this mysterious parameter can be found using only elementary physics, simply proposing that E is proportional to B, and finding that constant of proportionality.

Start with the same example that we used to find the gyromagnetic ratio of the electron, the charged particle motion in a circle due to uniform B. Now write down the kinetic energy of the particle – that’s right, just plain old

E = 1/2 m v2

Of course, v = r ω and we know from equating

m v2 / r = e v B  (the force due to B)

that m ω = e B. Propose there exists a constant of proportionality μ obeying

E = μ B = 1/2 m v2

where E is your expression you wrote down for kinetic energy. Solve for μ until you are satisfied that you have the same expression as you’d get by doing the integral above or using the current loop model I*A. You will obtain the same result as if you were to calculate

μ = IA = current x area = e ω/(2 π)π r2 = 1/2 e ω r2

or using the integral over current density J

μ = 1/2∫ d3x [r x J] = 1/2 r ρ*(Volume) v = 1/2 r e (rω) !!!

Note that here, ρ is charge density, so ρ (Volume) = total charge. The current density J is defined as ρv where v is the velocity of drift for the charge distribution ρ.