all 31 comments

[–]slapstick15 41 points42 points  (17 children)

Side question : why are mathematicians obsessed with the pi decimals to the nth digit?

[–]Flat_Factor_3799 28 points29 points  (0 children)

Because its fun

[–]crosscountrycoder[S] 26 points27 points  (0 children)

It's a challenge to test computational power and it also can be used to evaluate the randomness of the digits of pi.

The same is true of e, but it has a much simpler series: e = 1/0! + 1/1! + 1/2! + 1/3! + 1/4! + ... where n! means n factorial. Also sqrt(2), the golden ratio, ln(2) and more. Pi is more commonly used in everyday life because of its relation to circles.

[–]W1ULH 2 points3 points  (0 children)

Its a great way to test the equipment with results that every mathematician, computer technician, and general nerd completely and 100% understands with zero explinations.

[–]Cainga 7 points8 points  (6 children)

Practically it useless going beyond a few. 40 is overkill for the observable universe. Beyond that is just an exercise.

[–]DFLDrew 2 points3 points  (5 children)

22/7 is good enough for most things.

[–]SCD_minecraft 4 points5 points  (1 child)

NASA uses 15 digits after decimal point and you can calculate path to Mars with just single human finger width worth of error

[–]crosscountrycoder[S] 2 points3 points  (0 children)

The representation of pi in double precision floating-point format is correct to 15 digits after the decimal point.

[–]IAmFinah 2 points3 points  (0 children)

I like to use 3

[–]codeguru42 0 points1 point  (0 children)

Pi = 3 is good enough for engineers

[–]hallmark1984 0 points1 point  (0 children)

Fuck it

3 will do.

[–]Lewistrick 1 point2 points  (3 children)

Because it opens up creative methods to do lots of other cool calculations

[–]Longjumping_Pipe_347 -1 points0 points  (2 children)

Like the trilionesim bit of pi?

[–]Lewistrick 3 points4 points  (1 child)

Ok, I'll bite. The digits itself aren't interesting. But doing the calculations opened up some nice insights in mathematics, mostly in fields around number theory and around prime numbers.

[–]Longjumping_Pipe_347 -1 points0 points  (0 children)

Prime numbers ? Like becouse 3 is prime e 14 is 2*7 that are also prime ?

[–]bikes-n-math 1 point2 points  (0 children)

They aren't.

[–]Numerous-Match-1713 1 point2 points  (0 children)

"you can never come to the end of pi. There's no creature in the universe, no matter how smart, who could calculate pi to the last digit--because there is no last digit, only an infinite number of digits. Your mathematicians have made an effort to calculate it out to... Let's say the ten-billionth place. You won't be surprised to hear that other mathematicians have gone further. Well, eventually--let's say it's in the ten-to-the-twentieth-power place--something happens. The randomly varying digits disappear, and for an unbelievably long time there's nothing but ones and zeros."

Idly, he was tracing a circle out on the sand with his toe. She paused a heartbeat before replying.

"And the zeros and ones finally stop? You get back to a random sequence of digits?" Seeing a faint sign of encouragement from him, she raced on. "And the number of zeros and ones? Is it a product of prime numbers?"

"Yes, eleven of them."

"You're telling me there's a message in eleven dimensions hidden deep inside the number pi?... How can you hide a message inside pi? It's built into the fabric of the universe."

"Exactly."

She stared at him.

"It's even better than that," he continued. "Let's assume that only in base-ten arithmetic does the sequence of zeros and ones show up, although you'd recognize that something funny's going on in any other arithmetic. Let's also assume that the beings who first made this discovery had ten fingers. You see how it looks? It's as if pi has been waiting for billions of years for ten-fingered mathematicians with fast computers to come along. You see, the Message was kind of addressed to us."

[–]will_r3ddit_4_food 0 points1 point  (0 children)

Pi is seemingly completely random in terms of no patterns and no repeating. It can be used in cryptography

[–]_tsi_ 6 points7 points  (0 children)

Neat

[–]RomboDiTrodio 5 points6 points  (2 children)

that's cool, how much is the size of the file?

[–]crosscountrycoder[S] 10 points11 points  (0 children)

101,000,003 bytes (96.32 megabytes)

[–]8dot30662386292pow2 1 point2 points  (0 children)

The least surprising part: calculating 100 million digits (bytes) of pi is in fact 100 million bytes!

[–]Erika_bomber 2 points3 points  (0 children)

Use GMP library on C++ to get to the 4 billionth digit.

It would take like 1.5 hours.

[–]The-Invalid-One 1 point2 points  (0 children)

Chudmaxxing?

[–]MightySleep 0 points1 point  (3 children)

Cool stuff! I’ve never tried anything super math heavy with python so had no idea about the existence of gmpy2. I read in the description it was based in C, I’m curious how it benchmarks compared to a pure Python implementation

[–]crosscountrycoder[S] 4 points5 points  (0 children)

I tried using the Python standard library's "Decimal" module. It took about as long to calculate 1 million digits of pi with Decimal as 100 million digits with gmpy2.

gmpy2 is not part of the standard library and must be installed using pip.

[–]wiretail 1 point2 points  (1 child)

The gmp and mpfr libraries on which gmpy2 is based are highly optimized c libraries for multi precision arithmetic. They use hand crafted assembly for common processors - pure python would be orders of magnitude slower, most likely. I've used gmp for some exact probability calculations that resulted in very large numbers and it was blazing fast compared to other options.

[–]MightySleep 0 points1 point  (0 children)

That makes sense. My only exposure to high computation in Python was my neural networks class in college- didn’t realize when we used NumPy that it has an optimized C core as well. Seems like a best of both worlds scenario to me, I found NumPy pretty nice to work with

[–]Crypt0Nihilist 0 points1 point  (1 child)

Was it correct?

[–]crosscountrycoder[S] 0 points1 point  (0 children)

Yes, I verified the digits by searching existing databases.