March 14, 2010
Python pi.py Spigot
Here is pi.py (not to be confused with pypy), a short python implementation of Jeremy Gibbons's 2005 spigot generator for decimal digits of pi:
q, r, t, j = 1, 180, 60, 2
u, y = 3*(3*j+1)*(3*j+2), (q*(27*j-12)+5*r)//(5*t)
q, r, t, j = 10*q*j*(2*j-1), 10*u*(q*(5*j-2)+r-y*t), t*u, j+1
The code to drive the algorithm is longer than the algorithm:
count, digits = 0, pi_decimal_digits()
print '%6d: %s' % (
count, ''.join([str(digits.next()) for j in xrange(50)]))
count += 50
This little script can be quite handy if, for example, you want to look up where in the digits of pi you can find the phone number for the Mass Audubon Society that is down the road from my house:
> ./pi.py | grep --color 2599661
Conveniently, their phone number starts at the very visible 3087th digit of pi after the decimal point. My home phone number is a little bit further into the private section the pi phone book, at the 6,301,261th digit. And, if you must, you can reach me at my cell at the 22,000,091th digit, although I should warn you that my reception is not very good out here in the boonies.
Happy pi day.
Posted by David at March 14, 2010 08:35 AM
A couple things to note.
Davidmay points out that because of line breaks, you can't actually find all subsequences just by grepping like this. If you want to really do exhaustive searches, you'd have to do a real search without discontinuities.
Also, this algorithm isn't really fast enough to let me compute the 22,000,091th digit in a reasonable amount of time on my laptop. I had to cheat and use a pi searching service, of which there are several different flavors online.
There is something very odd about Pi.
You know how people say that they can never,
"break that vicious circle"?
Well here is why, and it has to do with Pi and the number of the Beast (the one who keeps people in the vicious circle). It can also be related to playing a record backwards and getting a demonic voice.
355/113 = 3.141592
Now Reverse, i.e. reverse the record (as if reversing the direction of the playing record).
553 + 113 = 666
It's creepy how accurate it is (up to 6 decimal places, now that's a very accurate number, i.e. to get 6 places correct after the decimal)
From 3 scripts in Revelations: the Bible says 144 000 people will be alive on Earth at the end of days....
If you add the first 666 decimal numbers in Pi you get 144...kinda creepy
I dunno it seems there may be some puzzle out there people must figure out and this is all just a big test while we are travelling between galaxies at light speed between galaxies hahaha
But seriously though, 355/113 = 3.141592 now reverse 355 to 553 and add 113 and you get the mark of the Beast
432,000 / 2= 216,000
We have come full circle. PI
On the Mazzaroth itís now age of Aquarius starts all over
Measure of man. Length of days can be measured
At the last trump
He signed over his power on 3/13/2020
First day of beast kingdom is PI 3/14/2020
Now we have 20/20 vision.