Greetings to all.

A recent post at math.stackexchange.com asked for good approximations to pi using the nine nonzero digits, the four arithmetic operations and exponentiation. The problem definition definitely suggests a computational solution, which is actually non-trivial because the search space of all legal mathematical expressions over the nine digits and with the aforementioned operations is so huge that it cannot possibly be searched exhaustively.

I managed to program a solution in Maple that is fairly compact and solves the problem for the approximation 355/113 which is good to six places. The computation is fairly intense and requires quite a bit of memory and a fast garbage collector and fast hashtables. Maple really shines here and proves it can do all three. The solution can be seen here.

As a habitual problem solver I tend to think of problems in terms of challenges, and I would like to propose one to the readers of this post, which is directed at educators at the high school and freshman university level. (If MaplePrimes is not appropriate for this please please indicate it to me and I will close the post.)

The challenge, which I hope you will enjoy, is to find a better (higher precision) nine-digit-formula approximation to pi using the operators described above. Apparently the next best one is 52163/16604 (Wikipedia). It would also be interesting to know whether there is another fraction with a smaller denominator (than 16604) that produces more correct places and whether one has to add concatenation of single digits to the set of operators, thereby increasing the chance of finding a solution but also adding considerably to the search space. Obviously there is a limit as to the size of the integers that can be obtained but 52163/16604 might be doable. And if you can prove that this is not possible then by all means go ahead and present the proof.

My program uses powersets, an exponential operation, and an indicator that we want to do better. Even if you cannot improve on 355/113 you might nonetheless succeed in reducing the running time of the algorithm.

Obviously the space of possible values can be expanded significantly by working with rationals and irrationals as the intermediate values rather than just integers.

Happy coding to all.

Best regards,

Marko Riedel


Please Wait...