I just used this magic number in a simple archiving program I am writing.
See if you can figure out what it means:
1 2 3 4
#define CARPP_MAGIC 0xCBABCBAB /* Magic number (try playing these as
* chords (on e.g. a guitar or piano);
* the C should be Cm and the B and A
* should be Bb and Ab respectively) */
DO NOT calculate pi in binary. It is conjectured that this number is normal, meaning that it contains ALL finite bit strings.
If you compute it, you will be guilty of:
* Copyright infringement (of all books, all short stories, all
newspapers, all magazines, all web sites, all music, all movies,
and all software, including the complete Windows source code)
* Trademark infringement
* Possession of child pornography
* Espionage (unauthorized possession of top secret information)
* Possession of DVD-cracking software
* Possession of threats to the President
* Possession of everyone's SSN, everyone's credit card numbers,
everyone's PIN numbers, everyone's unlisted phone numbers, and
everyone's passwords
* Defaming Islam. Not technically illegal, but you'll have to go
into hiding along with Salman Rushdie.
* Defaming Scientology. Which IS illegal--just ask Keith Henson.
Also, your computer will contain all of the nastiest known computer viruses. In fact, all of the nastiest POSSIBLE computer viruses.
@Seraph LOL, the first two may not matter, because you will also have the ownership and redistribution rights to all the books and films on there somewhere XD
@xander333. I think the point is that if you computed *all* of Pi, it contains somewhere every single finite length array of bits. Thus you would by definition, somewhere have all of the above. :P
(Of course, this is assuming you have the infinite amount of memory and computational power to compute a number whose expansion in binary or decimal is infinite ;) )
Algorithm Challenge: Create a program that finds the first binary occurrence of the string "Hello" in PI. I think I'm going to write one up here at work.
I think there is a power series for Pi as well, which would be easiest to implement, but apparently it doesn't converge very fast, so I guess it would be computationally inefficient.
I've heard of that I think; the polygon thing sounds like fun to me so I'm going to try that. It's really simple, all you need is a number of sides and the length of each side, and then A = 1/2 x perimeter x radius. You don't get an exact value for Pi but it's "close enough", it's like using the trapezium rule to find the area under a curve on a graph.
It doesn't matter if you lose some precision of course, because you can just increase the resolution of your polygon. Let me know if you find "Hello", any of you. I am guessing it will take a very very long time!
Wait, the radius of a polygon? As in the average, right? Why not just assume the radius is 1. Then your polygon approximates a circle of radius 1, whose area is exactly Pi.
I've got the best way to approximate Pi. Draw a circle with a diameter of 1 unit, now place a square around it with a perimeter of 4. Flip all the corners so that they point inward and the actually corner is touching the circle. The perimeter is still equal to 4. Repeat this step to infinity, each time you will have a perimeter of 4, and you will eventually have a circle with a perimeter of 4. Therefor Pi == 4.
You don't need pi for that.. (That is, if you don't have infinite memory). You might as well write all integers and look for stuff there..
Though I like the idea.
Here's a program which calculates the digits of pi: for(;;) std::cout << (char)(rand()%10+'0'); The only problem is that you can't know which ones they are.
Oh, I misunderstood what you meant. That is not bad actually XD. To be honest, I'm not sure I can work out what is wrong with it... Maybe Pi is 4. Then 4 is an irrational number. Cool I have an irrational amount of RAM :P
Ok, so the area is given by A = 1/2*r*p but since r = 1 we just want A = 1/2*p (LaTeX tags would be really useful right now)) and the perimeter is given by p = ns where n is the number of sides and s is the length of a side. But r and s are directly proportional (r ∝ s) which means that even with an assumed r I still need to calculate s. Now, I could also assume that s = 1, but then, does that not limit n?
Well my Analysis lecturer said it doesn't converge that fast, so I assumed you would need lots of terms to get a good answer. Just what I heard :) And I trust that lecturer, if not all of them XD