This repository contains an implementation of a newly discovered algorithm for calculating the digits of π using Catalan numbers, derived from . The algorithm uses high-precision arithmetic and optimized series summation to achieve efficient computation.
Calculating the digits of π has been a topic of interest for mathematicians and computer scientists alike. This project introduces a novel algorithm for π calculation that leverages Catalan numbers and fixed-point arithmetic.
The series representation for π used in this algorithm is derived from the inverse sine function:
By expanding as a series, we get:
Substituting and multiplying by 6, we derive the series:
Where is the nth Catalan number.
The implementation of the algorithm in Python can be found in the pi_gmpy.py
file.
To use the script, run the following command in your terminal:
python pi_gmpy.py
You will be prompted to enter the number of digits of π you want to calculate.
$ python pi_gmpy.py
How many digits of π? : 100
π = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679...∞
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or feedback, feel free to reach out via GitHub or email.