pi-calculation-with-catalan-numbers

Catalan π Algorithm

This repository contains an implementation of a newly discovered algorithm for calculating the digits of π using Catalan numbers, derived from 6 \arcsin(0.5). The algorithm uses high-precision arithmetic and optimized series summation to achieve efficient computation.

Introduction

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.

Algorithm

The series representation for π used in this algorithm is derived from the inverse sine function:

\pi = 6 \arcsin(0.5)

By expanding \arcsin(x) as a series, we get:

series

Substituting x = 0.5 and multiplying by 6, we derive the series:

series

Where C_n is the nth Catalan number.

Implementation

The implementation of the algorithm in Python can be found in the pi_gmpy.py file.

Usage

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.

Example

$ python pi_gmpy.py
How many digits of π? : 100
π = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679...∞

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or feedback, feel free to reach out via GitHub or email.