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 Castellanos 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
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 . 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
1415926535897932384626433832795028841971693993751058209749445 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) Felice Russo sent (28/04/99): Formula, value, digits employed,
digits OK, Rank Jud McCranie has found - at last, 03/05/99- the most wanted >100% approximation to pi: ln(2^3*3*10939058860032031)/sqrt(163)
= 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: = 3.14159265358979323846264338327973 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 3) pi of arbitrary accuracy using only
2 prime numbers and two distinct and nested functions 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]
b := evalf[1000](log[2](evalf[1000]
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:
*** 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:
*** One reader just named 'Jonathan' wrote:
Jud McCranie replied on my request, about this comment the following short not:
*** 10 years later this puzzle is still interesting to new puzzlers. Arkadiusz Wesołowski wrote (July 09):
*** 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. 5623326033875 0773901345202767139 > y = sinh( sin( log( ((2^3*factorial(5)*23*29)^3 + 751 - 7)^2 - 73^3 - 4751) / sqrt(659-7))) %2 = 9. 9426398 89937403 > x + y %3 = 3. 34825 559 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. *** On June 9-11, 2026, Arina Bator sent te following amazing contributios. Unfortunately she sent his results for thi page inside two pdf files. So I have no more remedy that just put a link to them. But please take a look over theme. You will find a lot of fun.Just for fun, I wanted to test my abilities in relation to Problem 50. I used the Monte Carlo method to randomly search through combinations of mathematical expressions in order to find approximations of the number pi. In the attachment, I am sending only a few of them.Regarding the approximations you called Type A, unfortunately I was not able to exceed the 100% barrier, although I did find many approximations that give a 100% result (I am including a few examples in the attachment).As for Type B, using the Monte Carlo algorithm mentioned earlier, I managed to find many solutions giving a 500% result (as in Wesołowski’s cases), as well as a few giving a 600% result - I am also including some examples in the attachment (File 1 below)... Later she wote again: After shifting from a pure Monte Carlo approach to an evolutionary algorithm, I managed to find a type B expression that yields a 700% result. After fine-tuning the model, the best solution I have been able to express symbolically so far has reached 800% (it uses the number 5 once and provides an approximation of pi to 8 decimal places).The results are in the attachment (File 2, below). ***On June 12, 2026, Arina Bator kept sending more results abit the same issue. I will add just the first of her commnetaries and the siz files attached to th whole emils she accumulated : Regarding Q1 of Puzzle 899, similarly to Arkadiusz Wesołowski, I have managed to find a set of 46 semiprime numbers that yield a solution very close to 1, though not exactly equal to 1. My best result for a 46-term set is 0.99999999999989130917, achieved by the following set: [4, 6, 9, 10, 14, 15, 21, 22, 25, 35, 38, 39, 58, 314, 35971, 72155, 110089, 151006, 318931, 344531, 364811, 399566, 419737, 476979, 478519, 483927, 491173, 524083, 630166, 646711, 727323, 893923, 895274, 926449, 943323, 950543, 1009127, 1090297, 1139631, 1234999, 1269679, 1364237, 1396154, 1419391, 1472335, 1476107]. In addition, I managed to find a set of 42 semiprime numbers that gives the result: 1.00000000000000199840. Here is that set: [4, 6, 9, 10, 14, 15, 21, 22, 25, 26, 33, 34, 355, 66323, 102395, 178979, 221933, 492143, 534433, 560789, 608198, 744383, 773203, 812887, 873479, 909785, 910873, 911779, 966383, 1105459, 1198165, 1253038, 1263811, 1423735, 1430678, 1512141, 1747787, 1809806, 1905407, 1983637, 1988909, 1996651]. ...
I actually used a
simulated annealing approach. The code is quite
amateurish, though—I’m only starting to learn this
method and experimenting with it, so there is
certainly plenty of room for improvement.
... I apologize for sending so many messages recently, but I have to admit this problem has really absorbed me. I tried to find a full solution to the Q1 of Puzzle 899; unfortunately, I have not succeeded so far. Following Arkadiusz Wesołowski’s approach, I decided to look for a solution close to 1 instead. So far, the best solution I have found is a set of 46 semiprime numbers, which gives an approximation of 1 with an absolute error of: 1.80903690669895e-2066 (where the error is computed as: 1 minus the sum of all fractions with denominators from the selected set). I am attaching this set in File 1, and the computed sum rounded to 3000 decimal places in File 2. I have also found a set of 22 semiprime numbers (File 3), which gives an approximation of 1 with an absolute error of: 3.85279810536216e-1974. Theoretically, one could either try to express the remaining difference 1 − (sum of all fractions with denominators in the selected set) as a sum of at most 24 additional reciprocals of semiprime numbers not already used( if it is possible at all for such a combination), or alternatively, if the goal is simply to approach 1, one could continue searching for sufficiently large semiprime numbers that increase the value of the sum and thus reduce the distance to 1. However, I am not sure whether this approach is meaningful, given that the problem is stated quite strictly and refers specifically to the value 1. Kind regards, *** the closest result to Q1 Puzzle 899 that I managed to find is a set of 27 semiprime numbers, which approximate 1 with an absolute error of: 2.88695936930526e-7114. I am sending this set in the attachment, in the file set.txt (8 KB), and the sum of their reciprocals in the file sum.txt (14 KB). So far, I have not been able to find additional elements that would further reduce the error or yield a complete solution, and the heuristic methods only reduce the error in a purely cosmetic way, without actually decreasing the exponent −7114 in the error’s exponential notation. Here are the five files sent together this last four emails: file 3, file 4, file 5 , file 6 & file 7.***
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||