Pi from the prime numbers?

• I
• bland

bland

TL;DR Summary
How in the hell can a mere mortal come to grasp this madness.
I just saw that one of the ways of calculating Pi uses the set of prime numbers. This must sound crazy even to people who understand it, is it possible that this can be explained in terms that I, a mere mortal can understand or it is out of reach for non mathematicians?

There is more than one way of calculating the value of ##\pi## using prime numbers. Which one did you have in mind?

For the purposes of my question it doesn't really matter which one, I'm just utterly bewildered where the connection is. What is the connection between using numbers that can only be divided by themselves or one, in other words numbers that are not divisible by any number other than the trivial cases, and a circle.

Janosh89, Jarvis323, FactChecker and 2 others
For the purposes of my question it doesn't really matter which one, I'm just utterly bewildered where the connection is. What is the connection between using numbers that can only be divided by themselves or one, in other words numbers that are not divisible by any number other than the trivial cases, and a circle.
This is what excites many people about mathematics. These extraordinary deep connections.

Janosh89, mfb, FactChecker and 1 other person
For the purposes of my question it doesn't really matter which one, I'm just utterly bewildered where the connection is. What is the connection between using numbers that can only be divided by themselves or one, in other words numbers that are not divisible by any number other than the trivial cases, and a circle.

But nine isn't a prime number.

malawi_glenn and berkeman
Nor is 15.

malawi_glenn
But nine isn't a prime number.
He gets to the prime number part later.

bland
But nine isn't a prime number.

Nor is 15.
Prime in the sense of "not divisible by 2."

malawi_glenn, Janosh89 and berkeman
9 is not prime. 15 is not prime. 2 is prime and is missing. Those are the odd numbers.

symbolipoint and PeroK
However, there are primes in the decimal expansion,
3 is prime.
14159 is prime.
2 is prime.
653 is prime.

dextercioby
It's possible that all primes numbers are in there somewhere! And, in fact, that all finite sequences are in there.

Aha. Every prime number is in the decimal expansion of pi with probability one. But does this prove every prime number is in the decimal expansion of pi? I'm inclined to think not. It appears that this mathematician also says not, and that no proof is known. You might be able to show that it is so with probability one, but that isn't a proof.

Aha. Every prime number is in the decimal expansion of pi with probability one. But does this prove every prime number is in the decimal expansion of pi? I'm inclined to think not. It appears that this mathematician also says not, and that no proof is known. You might be able to show that it is so with probability one, but that isn't a proof.
There's probability of one that you are misunderstanding something here!

Nik_2213, DaveE, berkeman and 2 others
To everyone who comments that the initial screenshot of the video contains non-primes, please watch the video. After the first few minutes, the video is about a series of primes.

Nik_2213 and jedishrfu
My point/joke was that you might break pi's decimal expansion into a concatenation of primes. I am not sure if this is true.

From Wikipedia, here is the square root of 2

e has an even simpler series representation

But is the reverse true - does any given transcendental or real number have a series representation using only integer ratios?

dextercioby
From Wikipedia, here is the square root of 2

e has an even simpler series representation

But is the reverse true - does any given transcendental or real number have a series representation using only integer ratios?
Trivially, we have
$$0.a_1a_2a_3\ldots a_i=\sum_{i>0}{\frac{a_i}{10^i}}$$
where each ##a_i## is an integer. We also have that the rationals are dense in the reals, meaning that any real number can be approximated arbitrarily accurately by the rationals. So the answer to your question as posed seems to be yes. Did you have something different in mind?

FactChecker, PeroK and sysprog
To everyone who comments that the initial screenshot of the video contains non-primes, please watch the video. After the first few minutes, the video is about a series of primes.

I did set the video to begin at the correct spot, which it does @ 1min 51", sorry for any confusion. I don't understand the earlier examples that use complete sets but it was the randomness of the primes that I find perplexing.

FactChecker
Trivially, we have
$$0.a_1a_2a_3\ldots a_i=\sum_{i>0}{\frac{a_i}{10^i}}$$
Did you have something different in mind?

Put more effort into your question and people might put more effort into their responses. I don’t want to play a guessing game as to what you might mean here.

malawi_glenn and sysprog
That's not a trivial solution. It's merely a simple, elegant solution. And as good as any other.

sysprog
I agree with @PeroK here ##-## in my view (which view is in my opinion less expert in the matter than is that of @PeroK or that of @TeethWhitener), the response of @TeethWhitener was spot-on ##-## it left the original question well-answered: he showed that a trivial solution was available, then brought in the fact that "the rationals are dense in the reals, meaning that any real number can be approximated arbitrarily accurately by the rationals", and also made sure to check lest his so-produced provisional 'yes' answer might not have addressed what the OP (@bland) was driving at.

Last edited:
bland
The prime method in the video is to take all prime numbers ≥ 2 and take the product of 1 + 1/p if p-1 is divisible by 4 and 1 - 1/p, giving
$$\left(1 - \frac{1}{3} \right) \left(1 + \frac{1}{5} \right) \left(1 - \frac{1}{7} \right) \left(1 - \frac{1}{11} \right) \left(1 + \frac{1}{13} \right) \left(1 + \frac{1}{17} \right) \left(1 - \frac{1}{19} \right) \cdots = \frac{2}{\pi}$$
which I think can be written succinctly as
$$\prod_{k=2}^{\infty} \left(1 + \frac{(-1)^{(p_k \mod 4 -1)/2}}{p_k} \right) = \frac{2}{\pi}$$
where ##p_k## is the ##k##th prime.

I am also very curious to know why this works.

I have tried calculating it in Mathematica, defining
$$f_p(n) = 2 \left[ \prod_{k=2}^{n} \left(1 + \frac{(-1)^{(p_k \mod 4 -1)/2}}{p_k} \right) \right]^{-1}$$
such that
$$\lim_{n \rightarrow \infty} f_p(n) = \pi$$
but the convergence is extremely slow. For instance, taking the first million primes gives
$$f_p(1000000) \approx 3.141571749764497$$

Janosh89, Klystron and PeroK
There is no royal road to ##\pi## only one that slowly converges on it. :-)

DrClaude
Gosh, that's amazing. I know I'll never be able to figure it out.

My point/joke was that you might break pi's decimal expansion into a concatenation of primes.
Have you ever tried? It gets surprisingly difficult surprisingly quickly.

Last edited:
No. I tried to see whether this was an issue with normal numbers and it got messy quickly.

I had hoped this would give me a sumbission for OEIS but it's already A047777.

sysprog, Office_Shredder and PeroK
I had hoped this would give me a sumbission for OEIS but it's already A047777.
I think that you might be interested in this, or might know someone who might be:

ALCF GPU Hackathon: Applications Due May 24​

 DATES July 19, July 26-28, 2022 ONLINE EVENT
The ALCF, in collaboration with NVIDIA, will host a free GPU hackathon on July 19 and July 26-28, 2022.

The multi-day virtual event is designed to help teams of three to six developers accelerate their codes on ThetaGPU using a portable programming model, such as OpenMP, or an AI framework of their choice. Each team will be assigned mentors for the duration of the event to provide guidance on porting their code to GPUs or optimizing its performance.

No previous GPU experience is required, but teams are expected to be fluent with the code they bring to the event and motivated to make progress at the hackathon. HPC, AI, or data science projects are welcome.

Applications to participate are due May 24, 2022.

For more details or to apply, visit: https://www.alcf.anl.gov/events/2022-alcf-gpu-hackathon

 ​
9700 Cass Ave.
Lemont, IL 60439

(post edited to include this link: https://www.alcf.anl.gov/support-center/theta/theta-thetagpu-overview)

Last edited:
pbuk
I think that you might be interested in this, or might know someone who might be:
Nah, not even 12 petaflops? Waste of electricity .

I'm not really interested in aspects of number theory that are only significant to ten-fingered humans anyway, I just fancied an entry in OEIS but now I see that this area is well covered already. It doesn't even make a good quiz question:

Q. What sequence is this:
14159,
2,
653,
5,
89,
7,
9323,
846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635342207222582848864815845602850601684273945226746767889525213852254995466672782398645659611635488623057745649803559363456817432411251507606947945109659609402522887971089314566913686722874894056010150330861792868092087476091782493858900971490967598526136554978189312978482168299894872265880485756401427047755513237964145152374623436454285844479526586782105114135473573952311342716610213596953623144295248493718711014576540359027993440374200731057853906219838744780847848968332144571386875194350643021845319104848100537061468067491927819119793995206141966342875444064374512371819217999839101591956181467514269123974894090718649423196156794520809514655022523160388193014209376213785595663893778708303906979207,
73,
?

Last edited:
sysprog
I am fascinated by sequences of prime numbers among integers, twin prime occurrence, intervals between Mersenne primes and related numbers. I sense or intuit a relation to π and the above series utilizing prime numbers to approximate π from studying related numeric series that converge on trigonometric identities.

Pi is ratio of circle's circumference to diameter. Trigonometric functions defined on unit circle contain π. I intuit or perhaps remember an old text that describes a relation to prime number sequences yet cannot put my finger on it. Perhaps numeric sequences approximating transcendental functions and those approximating transcendental numbers such as π resemble each other such that I am conflating series. This connection has bothered me since this thread began. Thanks.
We know that the uncountably infinite is of greater magnitude than the countably infinite, and we know that there are fewer algebraic irrationals than transcendentals, but we have not found a simple way to prove an arbitrary designatable real or imaginary number to be transcendental.

Regarding the special case of the transcendental number ##\pi##, Euler showed that ##\frac π 4 = \frac 3 4 \cdot \frac 5 4 \cdot \frac 7 8 \cdot \frac {11} {12} \cdot \frac {13} {12} \cdots## with the numerators being the odd primes (and the denominators being the nearest thereto multiples of 4) ##\dots##

Using e.g. the Sieve of Eratosthenes to find the odd primes to obtain that series to produce digits of ##\pi## is not as fast as using the more rapidly converging Gauss-Legendre Algorithm, but that algorithm is a core-hog (i.e. requires much memory) ##-## as you know, CPU time vs memory is a frequently-occurring trade-off.

Last edited:
Klystron
I had deleted my post, fearing I was off-topic but @sysprog ties it in nicely.

I am fascinated by sequences of prime numbers among integers, twin prime occurrence, intervals between Mersenne primes and related numbers. I sense or intuit a relation to π and the above series utilizing prime numbers to approximate π from studying related numeric series that converge on trigonometric identities.

Pi is ratio of circle's circumference to diameter. Trigonometric functions defined on unit circle contain π. I intuit or perhaps remember an old text that describes a relation to prime number sequences yet cannot put my finger on it. Perhaps numeric sequences approximating transcendental functions and those approximating transcendental numbers such as π resemble each other such that I am conflating series. This connection has bothered me since this thread began. Thanks.

Pi Day was a couple of weeks ago so this conversation is a bit late really. For those that missed the fun, Chris Caldwell's Prime Pages are a great year-round resource e.g. here's a nice big prime.

IIRC, the series described in the OP comes from a Fourier series.

And this year's ##\sqrt 10 ## square root of 10 day; 3.1622 was a much better approximation than any ##\pi ## day
Edit

You use the Fourier series for f(x)=x in ##[ \pi, \pi) ##, when combined with Parseval's identity, comes down to:

## \Sigma_{n=1}^{\infty} \frac {2(-1)^{n+1}}{n} sin(nx) ##

##\frac{1}{\pi} \int_{-\pi}^{\pi} f(x)^2 dx = \Sigma _{n=1}^{\infty} \frac {4}{n^2}##; still for f(x)=x on

##[-\pi, \pi)##

Last edited:
Klystron
Another interesting connection is that between ##\pi## and the Normal Distribution. Just how does ##\pi## pop up in its density function?