https://github.com/abhrankan-chakrabarti/pi-calculation-with-catalan-numbers
This repository contains a Python script that calculates the digits of π (pi) using a novel algorithm based on Catalan numbers and fixed-point arithmetic. The algorithm efficiently computes the digits of π by leveraging the properties of Catalan numbers, making it a unique and effective method for high-precision calculations.
https://github.com/abhrankan-chakrabarti/pi-calculation-with-catalan-numbers
arbitrary-precision catalan-numbers computational-mathematics fixed-point-arithmetic gmpy2 high-precision high-precision-calculation math mathematical-algorithms numerical-methods pi pi-calculation pi-digits-calculation python
Last synced: 4 months ago
JSON representation
This repository contains a Python script that calculates the digits of π (pi) using a novel algorithm based on Catalan numbers and fixed-point arithmetic. The algorithm efficiently computes the digits of π by leveraging the properties of Catalan numbers, making it a unique and effective method for high-precision calculations.
- Host: GitHub
- URL: https://github.com/abhrankan-chakrabarti/pi-calculation-with-catalan-numbers
- Owner: Abhrankan-Chakrabarti
- License: mit
- Created: 2024-06-21T17:07:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-22T22:30:33.000Z (over 1 year ago)
- Last Synced: 2025-05-21T16:15:15.704Z (5 months ago)
- Topics: arbitrary-precision, catalan-numbers, computational-mathematics, fixed-point-arithmetic, gmpy2, high-precision, high-precision-calculation, math, mathematical-algorithms, numerical-methods, pi, pi-calculation, pi-digits-calculation, python
- Language: Python
- Homepage: https://abhrankan-chakrabarti.github.io/pi-calculation-with-catalan-numbers/
- Size: 39.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Catalan π Algorithm
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.
## 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:

By expanding  as a series, we get:

Substituting  and multiplying by 6, we derive the series:

Where  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:
```sh
python pi_gmpy.py
```You will be prompted to enter the number of digits of π you want to calculate.
## Example
```sh
$ python pi_gmpy.py
How many digits of π? : 100
π = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679...∞
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contact
For any questions or feedback, feel free to reach out via GitHub or email.