Problems & Puzzles: Puzzles

Puzzle 50.- “The best approximation to pi with primes”

As usual, the subject was coming to me after visiting the Patrick De Geest beautiful pages. There was the following one: “Approximating pi with Palindromes”.

In that and the same place we are invited to see the Eric Weisstein's pi-pages (now are Mathworld-Wolfram pages) where from the Dario Castellano’s result was originally taken but now has disappeared.

1.09999901 x 1.19999911 x 1.39999931 x 1.69999961 = 3.141592573

BTW, in the Castellano's expression only the last two factors ate prime inetegers disregading the decimal point

Here you can see four pages devoted to the issue "approximations to pi": 1, 2, 3, 4

Then I modified a little bit the idea, and asked my self for the best approximations to pi usong only primes (not necessarily palprimes). I devised also a procedure (maybe a kind of arbitrary) to rank the different known approximations:

Points% = (Digits correct in the decimal part of the pi-result)/(Digits in the primes used for producing the pi-approximation)*100

 I got some of the “best” approximations from the Weisstein's pi-pages and made my own initial contribution.  From April 1999 to this February 2026 many results have been received and accomodated to the Table below.This is the updated result:

Pi and Primes

Pi = 3.1415926535898793238…

Author pi approximation Type Digits used pi-Result Digits OK/Digits Used Points
Ramanujan 19*sqrt(7)/(2*2^3) A 6 3.141829682 3/6 50.00%
Egyptians 2*11/7 A 4 3.142857143 2/4 50.00%
Stoschek 2^(3^2)/163 A 6 3.141104294 3/6 50.00%
Carlos Rivera 211891/67447 A 11 3.141592658 8/11 72.73%
Pi & Golden Ratio
(Author?)
3(3+sqrt(5))/5 A 4 3.141640786 3/4 75.00%
Jud McCranie 1833616417/583658233 A

19

3.14159265358979353

12/19

63.15%
Plouffe 43^(7/23) A 5 3.141539853 4/5 80.00%
Jud McCranie 3+(5*2216117)/(3*53*577*853) A

18

3.14159265358979316

15/17

88.23%
Jud McCranie 3+(3^3*5*851159)/(2*7*71*816427) A

19

3.1415926535897932390

17/19

89.47%
Gardner 3+((2^2)^2)/113 A 6 3.14159292 6/6 100%
Carlos Rivera  P(547)/((2*5)^547) A

552

See Below (Too large result 547 digits)

547/552

99.09%
Ramanujan & Olds 5*71/113 A 6 3.14159292 6/6 100%
Felice Russo sqrt(ln(33487/(sqrt(3)))) B

6

3.14159297

6/6

100%
Carlos Rivera ln(2^3*829453)/5 B

9

3.141592653609

9/9

100%
Jud McCranie ln(2^3*3*10939058860032031)/sqrt(163) B 23 3.141592653589793238462643383279726619 30/23 130.4%
Jean Brette
ln[(2^5*5#*23*29)^3+739+5]/sqrt(163) B 15 3.14159265358979323846264338327973 30/15 200%
Mike Keith See Below (Too large expression, B 48 See Below (Too large result, 231 digits) 231/48 481%
A. Wesolowski (sqrt(2+e^e)/e)^e &
sqrt(2+e^e)^e/ln(e^e^e)
B 1 Both: 3.141599009.. 5/1 500%
L. de Jerphanion e^e^e^-2 and
ln (e . ln (7! - 61))
B 1 & 3 3.1421918... &
3.1415925681
2/1 & 6/3 200%
Polly T. Wang ln(5*10691/11#) B 8 3.1415926539317..... 9/8 112.5%
 Jud McCranie 2*2*arctan(3-2) = pi
2*arcsin(3-2) = pi &
2*arccos(2-2) =
pi
C 4
3
3
Identities betqween pi & primes.
?
?
Paul Leyland lg(lg(SSSSSSSSSSSSSSSSSSSSSS(2)))/lg(lg(SSSSSSS(2))), C 2 Nested operators. As large as desired. See explanation below. ? ?
Types meaning:
A: Uses only elemental arithmetical operations as: +, -, * /, !, #, ^, Square rooth.
B: uses trascendental operators or constants as: e, ln,...
C: Uses matematical identities or nested operators

Verification Symbol means that I could verificate the expression sent. When I Could not verify the expression I wrote "Not verified by me". This laste case happened only with the expresions by Mike Keith.

Would you like to improve these results?


Solutions

See them in red color in the table:

Carlos Rivera (23/04/99):

Inside the limit of the current Ubasic (2032 digits) and working in Point 421 mode, you can probe that: int(pi*10^547) - 3*10^547
is the larger prime contained in the decimal digits of pi (disregarding the initial "3"). So the following number of 547 digits is prime (strongpseudoprime by now):

1415926535897932384626433832795028841971693993751058209749445
9230781640628620899862803482534211706798214808651328230664709
3844609550582231725359408128481117450284102701938521105559644
6229489549303819644288109756659334461284756482337867831652712
0190914564856692346034861045432664821339360726024914127372458
7006606315588174881520920962829254091715364367892590360011330
5305488204665213841469519415116094330572703657595919530921861
1738193261179310511854807446237996274956735188575272489122793
81830119491298336733624406566430860213949463952247371907021

Let's call it P(547). Obviously 3 + P(547)/((2*5)^547) produce pi with 547 correct decimal digits, using a total of 552 digits with all the primes (it happened that 547 is prime also!) for a rank of 99.09%

This constitutes a method for improving the approximation of pi, supposed you can find and probe the primality of larger and larger primes in pi.

p.s. I would like to add that some months ago (?) my friend G.L.Honaker invited to me to look for primes in pi starting with the "3" and disregarding the "decimal period". When I started defining and making some contributions to this puzzle I didn't related that search with it. Just this morning I awake with the idea of rescuing that primes but it happens that the largest of that kind of primes is 27 digits large, and I wanted something larger (specially after the Jud's result...). Then suddenly I made the final step: to throw away the initial "3" (why not?) and started looking for primes in the decimal portion of pi, with the result that there are primes with 5, 12, 281 and 547 digits....!.So, thanks Honaker...


Jud McCranie (23/04/99) has sent other two approximations to pi using only primes:

3+(5*2216117)/(3*53*577*853)
3.
14159265358979316
Rank = 15/17 =88.23%


3+(3^3*5*851159)/(2*7*71*816427)
3.
1415926535897932390
Rank = 17/19 = 89.47%


Felice Russo sent (28/04/99):

Formula, value, digits employed, digits OK, Rank
sqrt(ln(33487/(sqrt(3)))) = 3.
141592977847856 , 6, 5, 83.33 %
sqrt(ln(5351^2/1481)) = 3.
141592695171481, 9, 7, 77.8%
e^sqrt(10993/8389) = 3.
141592616712708, 9, 7, 77.8%
ln(19739/853) = 3.
141592105651308, 8, 6, 75%
e^75709/66137 = 3.
141592631719165, 10, 7, 70%


Jud McCranie has found - at last, 03/05/99- the most wanted >100% approximation to pi:

ln(2^3*3*10939058860032031)/sqrt(163) =
3.
141592653589793238462643383279726619
23 digits used and 30 digits OK.... for a 130.4% rank!!!!!!...

Have my most sincere congratulations, friend Jud....

* See below e comment by someone named "Jonathan"


Jean Brette has improved the Jud's result analyzing & changing the argument of the ln function. This is his amazing result:

ln[(2^5*5#*23*29)^3+739+5]/sqrt(163) = 3.14159265358979323846264338327973

which has the same
30 correct digits using only 15 digits of prime numbers for a pretty Rank of 200.00%.


Other relations between pi and prime numbers

1) Exact Relations between pi and prime numbers

Jud McCranie and Paul Leyland sent some exact relations between pi and prime numbers, based in known mathematical identities

Jud uses the known identity 4*arctan(1) = pi and produces the relation 2*2*arctan(3-2) = pi. Others are 2*arcsin(3-2) = pi and 2*arccos(2-2) = pi.

Paul uses the known identity e^(pi*i) = -1 to produce the relation pi=ln(2-3)/sqrt(2-3)

Of course, none of these relations can be used to calculate pi in any extent.

2) pi of arbitrary accuracy using only prime numbers to describe a Turing machine devoted to calculate pi

Paul Leyland
devised the following representation of
pi with arbitrary accuracy using nothing more than prime numbers:

"...However, if you don't want trig, exploit Godel numbering and Turing machines. Define a Turing machine and write a program for it to calculate
pi to arbitrary precision. This is tedious but clearly possible. The Turing machine, by definition, is a finite state machine and so can be encoded in a finite number of symbols --- use a distinct prime for each distinct symbol. Likewise, it is straightforward to write a finite program for such a machine which will output pi to an arbitrary number of places. The program can itself be encoded in a finite number of different primes, one for each distinct symbol. So far, it's been easy, but we need to encode the order in which the symbols appear. Suppose there are N symbols in total, not necessarily distinct. We start labeling the distinct symbols with successive primes starting from the (N+1)th prime. We then write the Turing machine and program as a product of powers of these primes. Everywhere symbol {i} appears, we raise it to the power of its position in the list of small primes. For all the symbols, we then accumulate the running product. The resultant product consists of nothing but primes, multiplication-symbols and exponentiation-symbols. On one interpretation, it's just a very large but finite integer. In another interpretation, it's an arbitrarily precise representation of pi. Interpretation is everything, even in the examples you give on your page"

3) pi of arbitrary accuracy using only 2 prime numbers and two distinct and nested functions

Paul Leyland
has also devised a 'formula' that produces the
pi value with arbitrary accuracy - as large as the accuracy of pi obtained with the ratio A/B of two previously known integers A & B - executing certain "mathematical operations" explicitly over only two prime numbers.

For example let's use the approximation to pi 22/7 = 2*11/7 = 3.142857 that has a Rank = 2/4*100 = 50%

The Leyland's formula for this specific approximation to pi is:

lg(lg(SSSSSSSSSSSSSSSSSSSSSS(2)))/lg(lg(SSSSSSS(2)))

where "lg" means "log base 2" and "SSS...SSS(2)" means "square root of 2, as many times as large is the S-string".

Well, this representation of pi, that uses only two digits in primes explicitly used, has the same accuracy referred to pi than 22/7, but a Rank = 2/2*100 = 100%. According to this example it is possible to increase the Rank up to an arbitrarily large quantity.

I asked for the hep of Mike Keith & Gennad Gusev for this verification of the Leyland's formula and here are their answers:

a) Mike Keith sent the following explanation.

b) By his side Gusev wrote:

I used Maple 2017 and calculted lg & sqrt  with 1000 digits after dot.
 
<<
a := evalf[1000](log[2](evalf[1000](log[2](evalf[1000](2.^(1/2^22))))));
b := evalf[1000](log[2](evalf[1000](log[2](evalf[1000](2.^(1/2^7))))));
print(evalf[10](a/b));
print(evalf[10](Pi));
          a/b =        3.142857143
           Pi =         3.141592654
>>
a/b & Pi are shown with 10 digits and that's enough.
2 digits after the dot are correct.

So, the Leyland's formula has been satisfactorily verified by two approaches.

 ***

Laurent de Jerphanion From Paris, France sent (26/10/2000) the following nice & new solutions:

"...it is relatively easy to get solutions at 100% :

3+sin sin (3) = 3.1406520...
7*e^cos(5/2) = 3.14170778...
2 * 7/(5-e/5) = 3.14158896...

Solution at 125% :

e + e^-e^-e^(-17/(3*3)) = 3.1415956...

Solution at 133% :

3+e^-e^e^(-2/5) = 3.14158389...

Solutions at 150% :

e + tan(2/5) = 3.14107504...
3/sin(3*e) = 3.14109534...
(ln ln (97+7/5))^e = 3.141592497...

Solutions at 200% :

e^e^e^-2 = 3.1421918...
ln (e . ln (7! - 61)) = 3.1415925681...

Although the last one would be downgraded to 120% in the form:

2/2 + ln ln (7! - 61)

...not to mention ‘infinite’ solutions with no digits at all (so they contain no non-primes), such as e + sin(e) = 3.12906311... But that is stretching things a bit..."

***

From time in time this puzzle brings new puzzlers! Now is the turn for Polly T. Wang who sent (October 30, 2002) the following solutions:

solution at 50%: e^((2^11+2*(2^2)!)/1831)=3.1415919.....
solution at 62.5%: ln(3*5*307/199)=3.14159312.....
solution at 70%:ln(2*463*929/3)/(2^2)=3.14159267....
solution at 75%: 3+(17/5!)=3.14166666.....
solution at 112.5%:ln(5*10691/11#)=3.1415926539317.....

***

One reader just named 'Jonathan' wrote:

' ...the solution "ln(2^3*3*10939058860032031)/sqrt(163) = ..." is simply an inversion of: e^(pi*(sqrt(163))) ~262537412640768744 that massive integer, and was known to Ramanujan. widely referenced in American literature, and appearing most notably in the April fools section on 1974 scientific American (which claimed that it had been proven to be an exact equality) so... it should be attributed to Ramanujan if anyone...'

Jud McCranie replied on my request, about this comment the following short not:

Yes, I knew it wasn't original with me. I didn't mean to imply that I originated it... I knew that fact about the close approximation to pi, I didn't discover it.

***

10 years later this puzzle is still interesting to new puzzlers. Arkadiusz Wesołowski wrote (July 09):

(sqrt(2+e^e)/e)^e = 3.141599009...
Rank = 500%

sqrt(2+e^e)^e/ln(e^e^e) = 3.141599009...
Rank = 500%

***

On Feb 24, 2026, Mike Keith sent a contribution to this old puzzle (since 1999):

I'm giving a talk in a few weeks for Pi Day, and I wanted to have a few interesting approximations to show, and I was led to your Puzzle #50 via the link on the MathWorld "Pi Approximations" page.  As a result, I tried to construct a solution with a high % ranking.
Attached is what I came up with - it has a "score" of 481%, which I think is larger than the other explicit solutions you currently have*.  Anyway, I thought you might like to see it.  The red digits at the end are the first incorrect digits; the other 232 digits (the initial "3" followed by 231 digits after the decimal point) are all correct.  This is similar to the Jean Brette solution, but I've added some things to increase the number of correct decimals from 30 to 231.


 

* n.b. by CR: As a matter of fact, the largest rank is 500% by Arkadiusz Wesolowski solution sent in July 2009 (17 years ago).

Mike Keith added the following calculation help, after I wrote him that I was unabe to verify his formula & results:

You can verify my formula with PARI - just copy and paste the following into PARI:
\p 235
x = log( ((2^3*factorial(5)*23*29)^3 + 739 + 5)^2 - 1823*(2*3)^3) / (2*sqrt(163))
y = sinh( sin( log( ((2^3*factorial(5)*23*29)^3 + 751 - 7)^2 - 73^3 - 4751) / sqrt(659-7)))
x + y
Here is what PARI prints out:
> \p 235
   realprecision = 250 significant digits (235 digits displayed)
> x = log( ((2^3*factorial(5)*23*29)^3 + 739 + 5)^2 - 1823*(2*3)^3) / (2*sqrt(163))
%1 = 3.14159265358979323846264338327950288419716939928207111478945141389163830170708
562332603387554054329117124445015862805613942556454925631824333841996024484209929488
0773901345202767139675950407752215793871466789858557955898229101611015736
> y = sinh( sin( log( ((2^3*factorial(5)*23*29)^3 + 751 - 7)^2 - 73^3 - 4751) / sqrt(659-7)))
%2 = 9.30347061854931784161781045791233753020009498015737768109036363546542505076682800602
94263988386939447883639018155403328800593318338419968672541202714588092962021117107977547
89937403721758633901555265944322288875028693327866518074705786 E-47
> x + y
%3 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280
34825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105
559644622948954930381964428810975665933446128475648233322

The last number agrees exactly with the digits in the graphic.  Note: E-47 means "multiplied by 10^(-47)".

After this, I (CR) consider the Keith's formula completely verified since now.

***

 


Records   |  Conjectures  |  Problems  |  Puzzles