## Pi in base 2

by ZapperX
Notes and Credits

[press space]

Here you go: Pi in base 10! And no, that does not controdict the title of this project. Press space for the variable to show Pi in base two. The cat is telling you how far it's gotten. I'm pretty sure it's correct. I'm also calculating this by hand, and I've gotten 34 digits so far that way.

How to do it:

The "places" in base two change by 1/2 as you move to the right; the 4s place, the 2s place, the 1s place, the 1/2s place, the 1/4s place, etc. Just like we have 100s place, 10s place, 1s place, 1/10s place, etc. What you do is calculate what the places are as a decimal:

2
1
.5
.25
.125
.0625
.03125
.015625

(as you can see it gets pretty hard). Then you take each place, and if pi is larger than it, than put a 1 in your calculation and subtract that from pi. You then use the subtracted pi. It goes like this:

3.14 > 2?
yes!
New pi: 1.14
current pi in base 2: 10
1.14 > 1?
yes!
New pi: 0.14
current pi in base 2: 11
0.14 > 0.5?
no!
New pi: 0.14
current pi in base 2: 11.0

etc. You get into some serious subtraction and division doing this (later it will take lots of subtraction to figure out the new pi). But it is very fun to do by hand; maybe you should try it. I would look up what pi is just to be sure, but this is what I have memorized of it and I'm pretty sure it's accurate:
3.14159265358979323846264338327950288419716939937510582097
(yes, I memorized 56 digits of pi!)

Shared: 2 Feb 2011 Modified: 2 Feb 2011

More projects by ZapperX